119,062 questions
Score of 0
1 answer
70 views
Get Kerberos TGT expiry time in Powershell
We have some of our more sensitive admin accounts into Protected Users in AD. This has a knock on of preventing the Protected Users from renewing Kerberos TGTs beyond their initial mandated four-hour ...
Score of 5
1 answer
202 views
System.IO.File, one writer, one reader, different computers. shared read open error
I have a script that may run on different computer but must run at most once at a given time. so I wrote a poor-man mutual exclusion based on file locking. Not the best code in the world but it does ...
Score of -1
1 answer
149 views
PowerShell version 7.6.3 (on Windows 11 Pro) Error 'Argument types do not match'
Script code:
# Get the next subfolder
foreach ($CurrentSubfolderDest in $NextSubfolderDest) {
# Create the full path for the new subfolder
$PathNewSubfolderDest = Join-Path -Path $...
Score of 1
1 answer
75 views
Powershell runspaces duplicated when added to pool
I have a loop that creates runspaces, adds them to $RunspacePool, executes .BeginInvoke() and eventually adds them to an array in synchronized hastable.
The scriptblock for each of the runspaces is in ...
Score of 0
2 answers
149 views
Why is my git command printing errors when doing Start-Job?
I have a very simple script that is supposed to download multiple repos simultaneously. But I am having trouble even getting one working.
$blah = Start-Job {
git clone https://github.com/...
Score of 4
1 answer
124 views
How to infer the class from which a System.Management.Automation.PSMethod object belongs to?
In this example, is there a way to programmatically infer the source object's ("MyTestString") type ? Assume that the source object is a literal and not stored in a variable.
PS C:\> $...
Score of -1
0 answers
99 views
Powershell Not Highlighting Coloured Text To Console [duplicate]
I have a PowerShell script that checks the HTTP status code of a website and i want it to highlight certain lines that say OK in Green and then the ones that fail in Red, but this is not functioning ...
Score of 0
2 answers
184 views
Updating Git for Windows unattended with PowerShell returns an error when run against remote servers
I maintain a lot of servers, and I am looking to auto-update Git for Windows on all of them periodically. There is a built-in way to do this with git update-git-for-windows -y.
This works great on the ...
Score of 2
1 answer
106 views
Setting Proxy Registry value via on PowerShell via a GPO
I am trying to set the proxy registry values via powershell deployed via a GPO as a logon script on my domain controller. The purpose is for all windows clients (7, 8 ,8.1 ,10 and 11) to have the ...
Score of 1
2 answers
197 views
PowerShell script with `-WhatIf` support [duplicate]
-WhatIf is a Common Parameter in PowerShell that describes the effect of the command, instead of executing the command.
How can I create a PowerShell script with -WhatIf support, so potentially ...
Score of -1
1 answer
205 views
Powershell splitting string into chunks not working
I have the following multiline string:
Inside Magic Kingdom Park at @waltdisneyworld is a memorial next to the Mad Tea Party that thousands of guests unknowingly pass by every day.
Randy Pausch co-...
Score of -3
1 answer
197 views
How do you run a PowerShell script with admin level permissions, but not launching a subprocess with admin level permission?
I wrote a PowerShell script that:
Kills Windows Magnify (built-in app), aka:
just Magnify, process, if it is running;
Runs Magnify in lens mode;
Launches GOG's Skyrim Anniversary Edition mod pack ...
Score of 2
1 answer
123 views
Getting WebView2 Assembly load errors when calling Add-Type. Is it my code or the assembly?
On Windows 11 Pro, using PowerShell v5.1, I'm trying to create a WebView2 browser pop-up dialog.
Add_Type function Parameters:
$fullPath = "C:\Program Files (x86)\Windows Kits\10\Windows ...
Score of 1
2 answers
229 views
Powershell "You cannot run this script on the current system"
I'm trying to install unsigned programs with Install-Module. I understand the risks of doing so.
After reading the error message, I looked into Execution Policies and tried to update my local one (...
Score of 1
1 answer
311 views
Codex CLI Update Error - missing OSArchitecture property
I get this error on Codex CLI every time I try to update codex when a new version is available.
iex : The property 'OSArchitecture' cannot be found on this object. Verify that the property exists.
I ...