55 questions
1 vote
2 answers
715 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?
1 vote
1 answer
510 views
Alternative to Get-Service for Remote Computer in Powershell V6.0
I have a script that uses Get-Service to see if a particular service exists and is running on a group of computers. Get-Service -Name "ServiceName" -Computername "PCName" In Powershell V6.0 the Get-...
0 votes
2 answers
2k views
Check/read registry key value on remote computer with local admin credential
How to check registry key value on computer which is not in domain?? I think that I must use local admin credential for this but I dont know how I tried this: $user = "admin" $password = &...
3 votes
2 answers
3k views
PowerShell, Cannot read data file
I have a PowerShell script that reads a register.psd1 file with contents as below. @{ # Building Zig compiler zig = @{ name = "zig" path = ./python/buildzig.py ...
0 votes
2 answers
246 views
PowerShell - Rename duplicate filenames in an object array
If I have some JSON like this: $inputJson = @" { "attachments" : [ { "name": "attachment.eml", "attachment_url": "https://www.attachment1.com"...
0 votes
1 answer
436 views
Problems with converting a string to timespan in order to sum a column imported from CSV
I want to import a CSV file with my working hours. Format is as follows: Description;Start Time;End Time;Duration;Day When I import the CSV, each object gets imported as string. I try to convert the ...
0 votes
1 answer
1k views
How to convert XML based XLS file to XLSX?
I have a bunch of XLS files. On opening the file I got the prompt: format and extension don't match Later, I found out that this is an old XML based XLS file. For that reason I couldn't directly ...
0 votes
2 answers
1k views
Powershell + 7zip to batch extract and rename - getting "No files to process" message
Edited: Originally, my question was why the first piece of code wont work. the unzip action was working if I run it on it own on on single file outside the loop. but once I wrapped it round with loop,...
0 votes
1 answer
1k views
Powershell Call cancelled
I was running Get-CimInstance -Namespace root/CIMV2 -ClassName CIM_Component | Out-File -Encoding utf8 .\CIM_Component.txt and received Get-CimInstance : Call cancelled At line:1 char:2 + (Get-...
7 votes
5 answers
16k views
Why doesn't Console in PowerShell ISE use the latest installed version of PowerShell?
I have recently installed PowerShell 6.2. If I start a PowerShell 6 (x64) command prompt and run $PSVersionTable.PSVersion this is the result Major Minor Patch PreReleaseLabel BuildLabel ----- --...
2 votes
1 answer
4k views
Powershell 6.2 and Get-CimInstance to remotely stop/start/restart service issues
So I am at a big roadblock right now. I was working in PowerShell 5.1 and had the Get-WmiObject with the Win32_Service Class working perfectly fine to remotely stop/start/restart services remotely. ...
5 votes
1 answer
3k views
What are PowerShell profile locations on Linux?
On Windows, not counting ISE or x86, there are four (4) profile scripts. AllUsersAllHosts @ C:\Program Files\PowerShell\6\profile.ps1 AllUsersCurrentHost @ C:\Program Files\PowerShell\6\Microsoft....
0 votes
0 answers
232 views
How to grant permission to AAD native app in PowerShell 6?
I registered a native application on Azure Active Directory via powershell 6 (module AzureAD.Standard.Preview) and I need to grant the permissions with powershell 6 code (Settings > Required ...
1 vote
1 answer
186 views
Is using Select-Object suitable when you don't have access to -Extension?
In Powershell v6, the split-path has the -Extension parameter to access the extension of a file name, for example: $pathToResume = "R:\Work\cover.letter_resume_base.odt" $extension = Split-Path -...
1 vote
3 answers
160 views
Powershell bigint output differ from declared value
I'm porting lesspass password manager to powershell, but I'm having trouble when implementing the _consume_entropy() method, especially the Python divmod. Reproduce PS> [bigint]$EntropyAsInt = ...