Questions tagged [powershell]
Windows PowerShell is a command line shell and scripting language for Windows that supersedes the CMD.exe shell and batch language. PowerShell is also an automation engine for Windows that provides functionality similar to Windows Script Host and VBScript.
6,148 questions
6
votes
1
answer
437
views
How can I prevent Microsoft Edge from restoring tab groups on startup?
Microsoft Edge persistently restores tab groups every time the browser is started, even when the startup setting is configured to "Open specific pages" (custom startup URLs).
There is no ...
1
vote
1
answer
143
views
How to read / change the "Regional format" setting in Windows 11 via PowerShell?
Executive Summary
In Windows 11,
I need the PowerShell commands (if they exist) which correspond to:
Settings -> Time & Language -> Language & Region -> Region (Subheading) -> &...
0
votes
0
answers
15
views
Creating clickable link to text file in Powershell [migrated]
I'd like to create a hyperlink to a text file in a Powershell script that'll be run in Windows terminal. I've made it work by hardcoding the link, ex. file://c:/textfile.txt but I'd like to compile ...
1
vote
1
answer
124
views
How to convert a PowerShell command into a batch file?
The following command works in PowerShell:
.\bcs.ps1 -sites a.com,b.guide,c.com
But produces an error when PowerShell is called from the command prompt. I removed the inner quotes and that doesn't ...
1
vote
0
answers
74
views
Powershell.exe Application error 0xc0000142 [closed]
I keep getting this error randomly when running some simple powershell scripts I have, for games. Sometimes when I get this error I open and close Windows Terminal and then the script works. Sometimes ...
0
votes
1
answer
385
views
How to get "pwsh.exe" to exist and to work on my Windows-11 machine?
I'm running the build of a complex Visual Studio solution and one of the error messages is the following:
'pwsh.exe' is not recognized as an internal or external command,
operable program or batch ...
3
votes
0
answers
53
views
Which Windows mechanism prevents downloaded PowerShell (.ps1) script files from being opened in a text editor directly from a file manager?
On a Windows 11 (version 10.0.26200.8037) box, the file association for .ps1 (PowerShell script) files is intentionally set to open all files with that extension in a text editor. Thus, double-...
1
vote
0
answers
58
views
How to scan for all PDF files in C:\ and copy to OneDrive folder
I want to use PowerShell to scan C:\ for PDF files excluding the C:\Windows and C:\Program Files folders and copy them to my OneDrive folder.
Here is what I have so far. It copies ONLY 1 PDF to ...
1
vote
0
answers
51
views
Windows Server 2016 - Millions of record in HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\PnpLockdownFiles. How Cleanup?
I have this Remote Desktop Server, built on Windows Server 2016.
The server is booting very slow. And logging in as an RDS user, takes several minutes, waiting on the Printer policy.
Now I found a big ...
2
votes
1
answer
281
views
How to achieve HISTCONTROL ignorespace on Windows?
In Bash you can prefix a Space to you command to stop command from being added to history
git commit -am "message"
cp existing.file new.file
How to do the same on Windows? A solution for ...
7
votes
3
answers
445
views
Why is the expected behavior of `Culture` vs. `UICulture` in Windows and Office display languages not consistent?
No matter what is shown in the Windows language and region settings (and by extension in Office language/region settings if they are set to match Windows' language), the display language (UICulture) ...
0
votes
2
answers
176
views
Powershell opens briefly, then disappears. It had been working fine
A newish (Sept) install of win10 Pro 22H2 (OS Build 19045.6466) on new MSI mobo w/ AMD Ryzen 5 5500GT
The native Powershell was working fine for awhile. After a period of time when I didn't use it, ...
5
votes
1
answer
211
views
How to run a command periodically with precise interval in Windows?
How to trigger a command periodically with a precise interval similar to watch -p(about ±0.5ms) in Windows from the command line, except using watch -p itself in Unix-like environments, e.g. Cygwin?
...
16
votes
4
answers
3k
views
Can a Windows administrator impersonate a user with lower privileges and execute a command?
How do I (an admin) run a command as a different user, and see their view of the world, on Windows?
i.e. what is the equivalent in cmd and/or powershell of the unix commands sudo -u some_user ...
3
votes
1
answer
251
views
What's the proper way to terminate a powershell script on error?
Every source I can find recommends terminating a powershell script on error by throwing an exception. This results in a good deal of repetitive and irrelevant diagnostic output. For example, the ...