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,135 questions
-3 votes
0 answers
30 views
Как запустить команды в свеже запушенной CMD через PowerShell? [closed]
Так как я облазил всё, что облазил, а у "Cursor.AI" спросить не могу веть мой трёх буквенный сервис лёг... :( Суть вопроса: Я не могу понять как мне в свежеоткрытый PowerShell под оболочкой ...
0 votes
1 answer
49 views
Install OBS VirtualCam silently
I have OBS VirtualCam installer taken from here: https://github.com/CatxFish/obs-virtual-cam/releases and I want to install it silently from PowerShell script like this: - powershell: | ...
-1 votes
2 answers
45 views
Regedit for windows settings
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
2 answers
71 views
Consolidate csv lines
I need to take multiple line items of a csv file and consolidate them into fewer lines while maintaining the information, as in the tables shown below: Turning this: Fave Fruit Student Apples Dave ...
-1 votes
0 answers
53 views
Load Environment Variable in PowerShell [closed]
I'm trying to load environment variables from a .env file into my PowerShell shell. But this is just opening up the file in my notepad: . .env . .\.env
1 vote
1 answer
34 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 vote
1 answer
121 views
How to remove uninstalled app from winget list?
So I am having this problem with winget on Windows 11 where it shows programs I have uninstalled still being supposedly installed. Uninstalling them via settings > installed apps only results in ...
-1 votes
1 answer
96 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
0 answers
61 views
Invisible text displayed in Windows 10 PowerShell
I've noticed that when using Windows PowerShell (to SSH into a computing cluster), sometimes parts of the text displayed in the terminal are missing or invisible -- if I try to select it with my ...
1 vote
1 answer
45 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 ...
0 votes
1 answer
101 views
How can I use PowerShell scripting to rename these files?
I am new to Powershell and i need help in renaming multiple video files. So a folder contains files named as below; 1. Episode S01E01.mkv 2. Episode S01E02.mkv 3. Episode S01E03.mkv … … ...
1 vote
1 answer
99 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 ...
4 votes
1 answer
138 views
VS Code integrated terminal: How to access suggest widget and PSReadLine MenuComplete via Ctrl+Space?
In VS Code's integrated terminal, Ctrl+Space by default triggers the terminal's suggest widget, but this doesn't show anything after e. g. <command> - or [<type>]:: although the PowerShell ...
2 votes
0 answers
167 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
0 answers
74 views
PowerShell command to list individual drive usage in a pool in Storage Spaces
Is there a powershell command to list the disks in a pool and how much of the drive is being used? The GUI in Windows 10 shows this information but I can't find a way to get it via powershell. ...
2 votes
1 answer
171 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 --...
2 votes
1 answer
74 views
How to wrap PS one-liner to run elevated
I need to run the following as admin from a non-elevated session. This works if initiated from an elevated one. [Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\MyPath&...
6 votes
2 answers
813 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 ...
2 votes
1 answer
127 views
Why am I seeing an unexpected code page in PowerShell properties?
Not sure if that matters, but OS is Windows 11, 24H2 This is freshly started admin powershell window, "Current language for non-unicode programs" is set to "English (United Kingdom)&...
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
67 views
Deploy Azure Arc Onboarding script via GPO
I am trying to onboard multiple Windows Server machines in my on-premise infrastructure to Azure Arc for the purpose of automating patch management. Because there are multiple servers in this scenario ...
0 votes
0 answers
122 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 ...
0 votes
0 answers
60 views
Exception calling "FindOne" with "0" argument(s) " network path not found while authenticating via LDAP
I have a PowerShell script that has a GUI, which has below where users enter the credentials, and it is redirected to the next page if he is a valid member. Below is the function to validate the users....
2 votes
0 answers
129 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: ...
-1 votes
1 answer
205 views
Launch Startup Apps in Parallel Minimized to Tray (Windows 11)
I have a lot of programs I want to launch automatically when I login to Windows. If I use the standard startup app functionality it takes forever, seemingly because they are started sequentially - the ...
0 votes
3 answers
723 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
1 answer
117 views
Outlook.application seeming inability to dynamically set Subject line
I have the below Powershell code, that each time it executes, leads to <no subject> being in the subject line of the received e-mails, instead of what is in $Subject. $Outlook = new-object -...
0 votes
0 answers
157 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. ...
0 votes
1 answer
394 views
How to remove bag attributes from certificate chain with openssl on Windows from the CLI : unable to load PKCS7 object
I have two certificates in base64 concatenated with bag attributes in a PEM file on Windows. I'm trying to remove the bag attributes of the myChain-Bags.pem file from the CLI : PS C:\temp> openssl ...
3 votes
1 answer
221 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 ...
0 votes
1 answer
369 views
Running python selenium script from Powershell
BLUF:Help me figure out how to run a selenium python script from PowerShell. Forgive the wordy post, adding some back story...Ok, so my at my job I have been tasked with automating the startup and ...
1 vote
0 answers
169 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 ...
1 vote
0 answers
161 views
How to permanently disable Windows Security Threat Found - action needed nag?
Background I am trying to run a minimalist instance of windows, where I do a lot of code testing, sometimes security related. It's running in a VM so minimizing non-essential Windows-11 bloat ...
3 votes
1 answer
317 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 ----...
7 votes
2 answers
814 views
Why is PowerShell not storing the process ID with Start-Process?
I am using PowerShell to start Chrome and then kill it. Start-Process gets the PID, but when I try to kill Chrome it says PID does not exist. The script: $myp = Start-Process "chrome.exe" -...
0 votes
0 answers
134 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 &...
1 vote
1 answer
159 views
Regex Pattern to find 2nd match
I created a powershell script to do certain tasks for our sales/finance department. Our system creates a large PDF file with several pages where each page is one invoice. The PDF file needs to be ...
0 votes
1 answer
105 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]::...
3 votes
0 answers
58 views
How to use only one of "Home" or "Quick access" in Move To and Copy To menus?
Officially, Microsoft claims that Quick access and Home are interchangeable, but under the hood, they are different entities: the former has a shell ID of 679f85cb-0220-4080-b29b-5540cc05aab6 (which ...
1 vote
1 answer
117 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
2 answers
153 views
Wait for a file not to change for 30 seconds, and then take a dump of an application [closed]
As mentioned in this other question, my application sometimes just stops executing (the application does not stop or crash, according to the task manager, but it no longer does what it is supposed to ...
1 vote
1 answer
269 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 ...
10 votes
1 answer
1k views
Which PowerShell commands are automatically scrubbed from Get-History?
I have a command to get a token for an API call. This seems to get scrubbed from history when the instance of PowerShell is closed though: PS C:\Users\siyakolisi> cd \ PS C:\> Write-Host "...
2 votes
1 answer
247 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
96 views
Why does Split-Path throw an empty string error for Get-Location FullName property -Leaf parameter?
PowerShell Version 5.1.19041.6093 This script creates the text file with the structure of all folders and files inside: PS D:\Csharp Projects\Slicer> # Get the current folder >> $rootPath = ...
1 vote
1 answer
78 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&...
0 votes
1 answer
317 views
PowerShell Script Fails via Task Scheduler (SYSTEM)
I work in an environment where most users are remote and use domain-joined laptops. These machines often remain off the corporate network for days and are commonly left in hibernation rather than ...
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 ...
2 votes
1 answer
104 views
Why does Visual Studio Code have special keybindings for pwsh?
I was updating some VSCode keybindings on Mac and saw these entries in default keybindings.json: { "key": "ctrl+space", "command": "workbench.action....
0 votes
1 answer
134 views
SSH works with Termux, but not on PS, WSL or Ubuntu
I have a work computer (Ubuntu) and a personal computer (win11 with Ubuntu WSL, port forwarding enabled). Using Termux in Android, I wrote the public key of my phone to the authorized_keys files in ...