50 questions
1 vote
1 answer
204 views
Update zipfiles with PowerShell 5 or >. Working code looking for improvement
Windows 10 64-bit. PowerShell 5.1 Update zipfiles with PowerShell 5 or >. Working code looking for improvement. 1.1.txt, 1.1.3.txt and 1.txt go in FileGroup0000000001.zip 11.txt ...
1 vote
2 answers
714 views
Ignore CTRL+C in delay - powershell
Whenever I set a delay in powershell using Start-Sleep, e.g: Start-Sleep 10 then it does not ignore CTRLC. I mean when I hit that key stroke the delay quits. How can I ignore it in delays?
6 votes
1 answer
679 views
Property passed to Invoke-Command changes type from IDictionary to HashTable
I've been getting an error running Invoke-Command where the script block takes a parameter of type dictionary: Cannot process argument transformation on parameter 'dictionary'. Cannot convert the "...
0 votes
0 answers
24 views
Restrict parameter to specific type; when using CimInstance [duplicate]
Is there a sensible way to restrict the parameter type used for a function when it may be encapsulated in a CimInstance? e.g. Say I have a method such as below: function Add-DaclAce { [...
0 votes
3 answers
803 views
Get-Package command includes xml string - Need to convert to PSObject
Need Windows Update Install Date from Get-Package SwidTagText object. The object is in XML format and everything I have tried to convert doesn't work. I am trying to switch from WMI because its ...
0 votes
1 answer
224 views
Interactively kill process using powershell
How can an interactive method for killing process in powershell be created? Kill process preferably in a form using input field to find and kill the processes desired.
0 votes
1 answer
646 views
Results in single string, need one per line
Trying to combine some properties from get-netadaptor with get-netipaddress tried everything I know but the results of the variable $getnet-name are all on one line ${getnet-name} = New-Object ...
0 votes
1 answer
744 views
How to get PS script to access folders that need admin access
I'm a desktop support tech for my company, and we often have a good bit of repetitive troubleshooting we perform such as clearing temp files and cache from C\windows\temp, local appdata temp folder, ...
0 votes
1 answer
467 views
How can I compress every X subfolder in a folder as a separate rar file
I am really new to Powershell coding and need your help please I'm on Windows 10 with Powershell 5.1 and trying to work it out with Winrar. The Main folder contains 5000 subFolders I would like to ...
0 votes
0 answers
150 views
Weird behavior when launching powershell through different ways
I have a Powershell script assigned to the context menu and it has been running fine. Recently, after I've reset my win10 system and then manually reconfigured my whole system Powershell begins to ...
1 vote
1 answer
920 views
Selecting multiple strings from the output of command in powershell
This may be a simple question that has been answered before but I just couldn't find it. I am trying to filter out unneeded text/output from a simple script I made. $stop = 2 do { clear netstat -a -n ...
1 vote
2 answers
1k views
How to print angular brackets in XML using powershell
I want to print the angular brackets(<,>) in powershell, but it is printing to > and < instead respectively. Is there any way I can print those symbols. I have used \ to overcome the bracket'...
2 votes
0 answers
2k views
powershell ftps upload causing error "DATA connection terminated without ssl shutdown" on stream close
I have the following code I have built upon something I found online (can't remember where) $Server = XXXXX $port = XXX $remotepath='/' $username = 'XXXX' #$passward = ConvertTo-SecureString -...
0 votes
0 answers
496 views
How can `Get-Command` return "commands" that aren't really commands?
'Get-Command' returns a list of all available commands in a powershell session. The following code evaluates to $false, when passed a string which is not a command: function f($x) {[bool](Get-...
8 votes
1 answer
4k views
Write-Information does not show in a file transcribed by Start-Transcript
I'm using PowerShell 5.1 and I am trying to determine why Write-Information messages do not show in the transcript log created by Start-Transcript unless I set $InformationPreference to ...