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,133 questions
3
votes
0
answers
35
views
How can I run a ps1 script from the context menu in Windows Terminal - but ALWAYS open a new WT window instead of the script running in a new tab?
I have set up some right-click context menu entries for .ps1 files to run PowerShell scripts in Windows Terminal instead of ConHost. Screenshot:
So I can run a one-off script elevated or un-elevated ...
1
vote
1
answer
28
views
how do I get activate.bat to work using pycharm powershell as terminal [closed]
I'm trying to set up virtual env for pytest using pycharm which is using powershell for the terminal and the activate.bat is not recognized and neither is the .\activate.bat it suggests
-1
votes
2
answers
55
views
Regedit for windows settings [closed]
I am trying to create a powershell script as I work for a small IT company and in the script I want to edit alot of windows settings in personalization, Privacy & Security, System, and Apps. Also ...
1
vote
1
answer
40
views
Export-WindowsImage Loop Not working with SWM files but works with WIM files
I needed to update some drivers on some Win11 installation thumb drives we have. These were made via the Media Creation Tool from MS so, these aren't some fancy homemade images. The thumb drives ...
-1
votes
1
answer
102
views
How to Set-ExecutionPolicy to LocallySigned?
I seek an Execution Policy which requires local scripts to be signed, and prevent downloaded scripts from being executed.
The goal is to disallow unapproved execution of downloaded scripts, and to ...
1
vote
1
answer
51
views
VS Code Powershell - In fullscreen, Terminal text moves upward when reopening
I'm using the powershell terminal on VS Code. I fullscreen the terminal because I can see more stuff that way.
The text of the terminal moves upward after closing and reopening, but the terminal ...
1
vote
1
answer
114
views
How to remove old Unknown USB devices from the list of COM ports?
I have a Windows 10 Enterprise LTSC device to which I need to connect and disconnect different USB devices. I can hear the sound of connect/disconnect and I can see the USB device appear/disappear ...
2
votes
0
answers
177
views
How to allow Powershell Profile Script to run unsigned when Profile is stored on the Network
A long time ago, the office changed our Network Profile to be stored on a file server, rather than locally (makes complete sense), so they're now in a path along the lines of \\<Domain>.local\...
2
votes
1
answer
186
views
Scripting (automating) installation of a WSL distro
I tried to get around the user prompt when installing a distro via wsl --install Ubuntu --name MyUbuntu --user root.
I need this to script the creation of the distro in PowerShell. Sadly, option --...
6
votes
2
answers
838
views
How do I make Windows open ps1 in PowerShell 7.x (black icon) instead of Windows Powershell (blue icon)?
Whenever I double click a ps1 file, it opens in NotePad. If I right click it, then click "Run with PowerShell", Windows will run it using the Windows Powershell (the one with the blue app ...
0
votes
0
answers
84
views
Follow up on "How does windows decide which executable to run"
This question is the follow up question for this answer:
https://superuser.com/a/897645/3054995
Does Windows executes the first discovered executable with typed name, or last discovered executable?
e....
0
votes
0
answers
134
views
PowerShell immediately exits with [process exited with code 1 (0x00000001)] even after SFC repair
I’m on Windows (11, 64-bit). Whenever I try to open PowerShell (either through Windows Terminal, VS Code terminal, or directly from Start → PowerShell), it immediately closes with the following ...
2
votes
0
answers
159
views
How to see the maximum boost clock of my CPU in cmd or PowerShell?
I am running Windows 10 Pro off a Lenovo P51 Thinkpad (i7-7820HQ 4C8T).
I am trying to get the maximum boost clock speed of my CPU by using
wmic cpu get maxclockspeed
in the cmd. It outputs:
...
0
votes
3
answers
905
views
Powershell get motherboard serial number
I need to learn serial number of a computer. How can I do this with PowerShell. I was using wmic bios get serialnumber but its deprecated and removed on windows 11.
0
votes
0
answers
167
views
How to execute a PowerShell script using service account on local user machine?
I have created simple GUI using PowerShell to search for a file and move the file if necessary. The files are sensitive and in prod location ,hence local user will not have access to file location.
...
3
votes
1
answer
237
views
How to query tokenGroups attribute?
ChatGPT told me that I can see tokenGroups of a user with PowerShell command like this:
Get-ADUser <username> -Properties tokenGroups | Select-Object -ExpandProperty tokenGroups
but when I try ...
1
vote
0
answers
178
views
Why does PowerShell's get-appxpackage return PackageUserInformation differently in Windows 11 24H2?
We are currently in the process of moving from Windows 10 22H2/Windows 11 23H2 to Windows 11 24H2.
One of my scripts relies on get-appxpackage for tracking version numbers.
On any client with a ...
3
votes
1
answer
365
views
How can I know if my Acer Nitro Lite 16 NL16-71G has soldered RAM?
I don't know if my RAM is soldered. I tried running the following command in PowerShell:
Get-WmiObject Win32_PhysicalMemory | Select-Object DeviceLocator
And it shows the following:
DeviceLocator
----...
0
votes
0
answers
138
views
PowerShell Get-NetFirewallRule takes over 3 minutes on domain-joined Server Core
I'm working on a PowerShell script to query all active firewall rules on a domain-joined Windows Server 2022 Core machine.
The command I'm using is:
Get-NetFirewallRule | Where-Object {$_.Enabled -eq &...
0
votes
1
answer
111
views
Enable trust for certificate w/o user prompt
I need to establish trust for ASP.NET Core HTTPS development certificate. I tried
dotnet dev-certs https --trust
and
$output = dotnet dev-certs https --check | Out-String
$thumbprint = [Regex]::...
1
vote
1
answer
130
views
Verify an SST certificate store before importing it via PowerShell
This guide details a simple fix for devices with improperly configured certificates which involves downloading a root certificate list from Windows Update and then importing it:
There is a manual way ...
1
vote
1
answer
298
views
How to make a schedule task visible for all users
In scheduled tasks for windows there is a folder called Microsoft which contain shared tasks that seem to be visible for all users. I would like to have my own folder that with tasks that are visible ...
2
votes
1
answer
255
views
"Open PowerShell window here" fails for certain directories
I'm using Windows 11 24H2 Professional. When I click "Open PowerShell window here" in the Explorer context menu with Shift held down, it always fails for directories with whitespaces. The ...
1
vote
1
answer
81
views
Troubleshooting simple script for sending keypresses to top-most window
I am trying to run a very basic powershell script that should be sending an 'Enter' keypress to the top-most window to close a pop-up. I made sure to change the ExecutionPolicy to "RemoteSigned&...
8
votes
1
answer
1k
views
Identifying an EXE file's PE type via PowerShell
Preamble
I am trying to ascertain the platform-type of an EXE and I cannot reconcile what I'm seeing with any known source.
I have a bit of PowerShell which reads the first 30 characters of an EXE as ...