resolver101
35 questions
0
votes
0
answer
3
views
using google storage and google vision API
I have the follow function that passes a image url to google vision service and returns the letters and numbers (characters) in the image. It works fine with general web urls but I'm calling it to access files stored in Google storage, it doesn't work. How can i get this to work? I've looked at ex...
1
votes
0
answer
440
views
ptvsd with visual studio code “pydev debugger: warning: trying to add breakpoint to file that does not exist”
When I run the following debug from a Visual studio code (Windows computer) to a Raspberry PI. I get the following error twice :
pydev debugger: warning: trying to add breakpoint to file that does
not exist:
/home/pi/testdebug/C:/IOT/Github/RaspberryPi/test_remote_debug/test_remote_debug.py
(will...
1
votes
1
answer
3.5k
views
Windows 7: Change the priority of traffic to wired instead of the wireless connection?
On Windows 7 clients I have to change the metric of the wired network connection to a lower metric than the wireless so traffic is prioritized over the wired connection. Is there a way to do this through a script using powershell?
To do this manually i -> Open network and sharing centre -> click th...
1
votes
1
answer
446
views
Python: Formatting time for influxdb
I want to input a date/time into influx db from python but not sure how to do this. Python code datetime.datetime.now() currently gives out a format like this : 2018-06-25 13:59:36.698000.
I know this format is accepted by influx '1529932431998' which is '2018-06-25T13:13:51.998Z' or '0x1643714427...
1
votes
1
answer
611
views
powershell: extract meta data from a list of websites
I have a list of websites in a text file and I wish to collect the meta data of the home page. How can I do this?
For example, the website '' meta data I want to retrieve is
meta name='keywords' content='**Chamber of Mines, South Africa, Mining**
1
votes
1
answer
52
views
SQLite: How do I update values from another?
How do I update values from another table where the value of the column is 2010?
This is the select SQL statement that returns the results I want
SELECT Devices.Name,TempKaspersky.Lisence
FROM TempKaspersky
INNER JOIN devices
On lower(TempKaspersky.MachineName)=devices.name
Where TempKaspersky.Lisen...
1
votes
1
answer
73
views
Rename files based on the previous 2 directory names
I want to rename files based on the previous 2 directory names. For example, the file below:
C:\temp\288\Issue level 1\288 Temper inad.doc
I want it to be renamed
288-Issue level 1-288 Temper inad.doc
I have created the following powershell command :
Get-ChildItem 'C:\temp\288\Issue level 1' -Filter...
1
votes
1
answer
168
views
InfluxDB and pandas errors in Python
im following the instructions to read data from influx into pandas and im getting the following error:
ValueError Traceback (most recent call last) in ()
----> 1 df = pd.DataFrame(AandCStation)
2
3 #AandCStation['time'] # gets the name
4
5 #AandCStation.values
C:\U...
1
votes
1
answer
1.8k
views
powershell to un-install muliple applications ?
I'm new to PowerShell and I'm looking for a way to un-install multiple applications. I have a list of applications in a text file that i want to Un-install. Here's the code i have so far:
# Retrieve names of all softwares to un-install and places in variable $app
$App = Get-Content 'C:\temp\un-ins...
1
votes
3
answer
991
views
Powershell: How do i create a function for the output of system.object?
im writing a script to get services from local and remote machines. I've had to split the wmi call for local and remote machines (remote machines require different credentials). I want to output them as System.Object. How do i create a function for the output of system.object?
heres the code i...
1
votes
1
answer
12.9k
views
Powershell: Cannot convert 'System.Object[]' to the type 'System.String'
When I run the following code i receive the message 'cannot convert 'System.Object[]' to the type 'System.String''. How do i pass the event log list back to get-eventlog?
$EventLogList = Get-EventLog | Select-Object -ExpandProperty log
Get-evenlog -log $eventloglist
Get-EventLog : Cannot convert...
1
votes
1
answer
2.2k
views
Powershell: filtering event logs
Ive written a small script to retreive event logs from application for the last 10 days but i receive the error. Any ideas why the error appear?
Where-Object : Cannot bind parameter 'FilterScript'. Cannot convert
value 'False' to type 'System.Management.Automation.ScriptBlock'.
Error: 'Invalid cast...
1
votes
1
answer
340
views
Powershell: function parameters
I'm building a powershell function so i can query multiple computers event logs. Ive copied the code below that i need help with. If I don't send an eventID, I want the script to find all event ID's, how can i achieve this?
#this would be the parameter part of the script
[String]$ComputerName = $...
16
votes
3
answer
75.8k
views
SSIS expression: convert date to string
I'm new to SSIS and I'm trying to convert a GetDate() to string 'DD-MM-YYYY'. This is the expression I've built so far:
(DT_WSTR, 8) DAY( GETDATE()) + '-' + (DT_WSTR, 8) (MONTH(GETDATE()) - 1) + '-' + (DT_WSTR, 8) YEAR(GETDATE())
The problem I've got is Month() converts the Month '23-4-2013' to a...
16
votes
4
answer
32.5k
views
powershell testing a variable that hasnt being assign yet
I want to test to see if a variable has been assigned a variable and if not perform action. How can this be achieve?
I've attempted it with the following code but receive the error: The right operand of '-is' must be a type.
$ProgramName is not assigned at this point.
If ($ProgramName -isnot $...
17
votes
5
answer
11.3k
views
Test admin rights within PowerShell script?
Whats the best/easiest way to test for administrative rights in a PowerShell script?
I need to write a script that requires administrative rights and want to know the best way to achieve it.
1
votes
2
answer
44
views
How do i join custom object to a string
I want to test paths exist. I've written the following script but i cant add string to custom object. This is the offending line $DesktopCheck = | $FName + '\desktop'. How do i add the string 'desktop' to custom object $fname?
$FoldNames = dir \\server\RedirectedFolders | Select-Object fullname...
2
votes
2
answer
16.8k
views
powershell: script to start a program with parameters?
When i run the Powershell script below i receive the error below. How do i run programs through powershell with parameters? The script will be a group policy logon.
Invoke-Expression : A positional parameter cannot be found that
accepts argument '\TBHSERVER\NETLOGON\BGInfo\BGIFILE.bgi /timer:0 /s
il...
2
votes
3
answer
4.7k
views
powershell: how to retrieve the computer name in dns format
I want to retrieve the current computer name as an FQDN on a windows 7 machine e.g. computername.companyname.local. How to achieve this?
2
votes
3
answer
14.4k
views
How do I get unique values from this array in PowerShell?
Why is the code below returning $null? I'm trying to store just unique values.
$DailyPathsToDelete = @('C:\temp\IMG000483\','C:\temp\IMG000483\')
$DailyPathsToDelete = Select-Object $DailyPathsToDelete -Unique
4
votes
3
answer
15.3k
views
How do i get the drive letter of a USB Drive in Powershell?
I've seen articles in C# and some other languages that explain how to acheive what im looking for but i dont know how to convert them.
The following link explains how to get the answer:
How can I get the drive letter of an USB device?
Win32_DiskDrive-> Win32_DiskDriveToDiskPartition -> Win32_DiskPar...
2
votes
1
answer
586
views
powershell remote jobs
Why am I getting the error for the code below:
Get-Job -Id 1 | Select-Object -ExpandProperty childjobs | Where-Object {$_.state -eq 'Completed'} | Select-Object -ExpandProperty id | Receive-Job
Receive-Job : The input object cannot be bound to any parameters for
the command either because the comma...
2
votes
1
answer
2.9k
views
powershell: Changing start type of services on a windows 7 machine
Ive wrote a script to get the services of a machine and i want to mirror the StartMode to another machine. I cant think of how to achieve the latter: setting the services on the remote machine. Heres a script ive written so far:
#List of Issue of services
$NamesOfIssueServices = 'Browser', 'Dhcp'...
1
votes
3
answer
6.9k
views
Comparing 2 folders and saving the paths into a variable?
I've been given the task of comparing 2 folders, FolderA and FolderB and noting any files that exist in A but not in B.
Sorry for not explaining myself fully. Maybe it would help if I explain our situation. A company sales employee has left our company to go to a competitor. He has files in on h...
1
votes
1
answer
37
views
Python : Open chrome with parameters
I'm trying to open chrome with parameters but I figure how to do it. Can anyone help me out?
I've listed the commands, one that works (without any parameters) and one that doesn't (with parameters):
call(['chromium-browser','']) # this works
call([''chromium-browser --start-fullscreen'','']) # th...
3
votes
2
answer
16.2k
views
Powershell: error handling with try and catch
I'm writing a script and want to control the errors. However im having trouble finding information on error handling using the try, catch. I want to catch the specific error (shown below) and then perform some actions and resume the code. What code is needed for this?
This is the code i am runni...
5
votes
6
answer
7.4k
views
powershell: get-winevent has no messsage data?
When I run the script below to retrieve log files, the get-winevent 'message' field is blank but has data if I run get-eventlog. Any ideas why?
#has message data
Get-Eventlog -LogName application -Newest 10
#date 10 days ago
$EventStartDate = get-date('10 May 2012')
$EventEndDate = get-date('11 M...
24
votes
4
answer
73.7k
views
Powershell: Extract text from a string
How do I extract the 'program name' from a string. The string will look like this :
% O0033(SUB RAD MSD 50R III) G91G1X-6.4Z-2.F500 G3I6.4Z-8. G3I6.4
G3R3.2X6.4F500 G91G0Z5. G91G1X-10.4 G3I10.4 G3R5.2X10.4 G90G0Z2.
M99 %
The program name is (SUB RAD MSD 50R III). Storing the result in anoth...
2
votes
1
answer
4.6k
views
Get-WinEvent start and end dates not filtering records
The get-winevent start and end dates are not filtering records. Can anyone tell me why? I expect from the code below the last 2 days events but i gets dates going back to 2010 (my Windows clock date is correct)
[String]$ComputerName = $env:COMPUTERNAME#Current computer
[String[]][email protected]('...
1
votes
1
answer
82
views
Python: create dictionary inside dictionary to convert to JSON
I want to create the JSON:
[
{
measurement: 'Equipment1',
fields: {
Pressure: 5.5
},
tags:{
MachineType:'type1'
},
timestamp: 1530717056.48
}
]
The code ive written is :
import json
import time
from decimal import Decimal
count = 0
read_pressures = []
while (count < 100):
current_time=time.time()
a...
1
votes
3
answer
7.3k
views
Setting the time of a System.DateTime object in PowerShell
I wish to set the System.DateTime object below with the time from $time:
$CurrentTime = (date)
$Time = '9:00'
How do I get the date from $CurrentTime, but with hours, minutes, seconds from $time?
1
votes
4
answer
3.9k
views
powershell: get-psdrive and where-object
Im trying to find every drive letter that isnt 'C,E,L,S,T,W' on a windows 2008 server. Can anyone tell me the fault in my logic or how i can do this please?
[char[]]”CELSTW” | Where-Object {!(Get-PSDrive $_ )}
1
votes
2
answer
2.7k
views
powershell: comment based help
I've created a small script to test creating my own help based powershell and i received error:
Get-Help : Cannot find Help for topic '.\testHelp.ps1'. At line:49
char:15
+ Get-Help
2
votes
3
answer
43
views
Python : batch up a number of readings and send in json
I'm a little confused by JSON and Python objects, I've read up a lot on python dictionaries but still no look. I have a Raspberry Pi with a sensor to read pressure. I want to batch up a number of readings and send to MQTT server. I want the output of the data to look like:
{'pressure': 2, 'time':...
5
votes
5
answer
18k
views
Using PowerShell's Add-Member results in an error
Why does the script below come up with the following error?
'Add-Member : Cannot process command because of one or more missing
mandatory parameters: InputObject.
+ $obj = Add-Member