Can You Uninstall Microsoft Edge Using PowerShell? (What Works)

Uninstall Microsoft Edge using PowerShell

You can only uninstall Microsoft Edge using PowerShell or Settings if your PC was set up in the European Economic Area (EEA). In the US and everywhere else, Windows treats Edge as part of the operating system and blocks its uninstaller. Below I show how to check what’s installed and why removal is blocked, the … Read more

Fix “Running Scripts Is Disabled on This System” in PowerShell

Fix PowerShell running scripts is disabled on this system

To fix “running scripts is disabled on this system” in PowerShell, set the execution policy to RemoteSigned for your account. It doesn’t need admin rights: The error means the effective policy is Restricted, which is the default on Windows client PCs. Below I reproduce it, check every policy scope, and show fixes from a single … Read more

How to List Local Users with PowerShell (Get-LocalUser)

List local users with PowerShell

To list local users with PowerShell, run Get-LocalUser. It returns every local account on the PC, including the built-in ones, with whether each is enabled: Output: Below I filter enabled accounts, compare Get-LocalUser with net user and CIM, export a report and check remote PCs. I masked my own account names in the output. What … Read more

How to List USB Devices Using PowerShell

List USB devices using PowerShell

To list USB devices using PowerShell, run Get-PnpDevice and keep the devices whose InstanceId starts with USB. -PresentOnly limits the list to what’s plugged in right now: Below I group devices by type, list USB hubs, find USB drives, and show where Windows keeps a history of devices. I only show device classes and generic … Read more

How to Find the OU of a Computer Using PowerShell

Find the OU of a computer using PowerShell

To find the OU of a computer using PowerShell, get its DistinguishedName with Get-ADComputer and drop the first CN= part. What’s left is the OU path: Get-ADComputer needs the ActiveDirectory module from RSAT. Below I check the prerequisites, show the parsing step on sample Contoso names, and cover bulk lookups and a method that doesn’t … Read more

How to Set and Get Environment Variables in PowerShell

Set and get environment variables in PowerShell

To set an environment variable in PowerShell, assign it with $env:, and to get it, read $env: the same way. This lasts until you close the window: Output: To keep a variable after you close PowerShell, save it to the User or Machine scope with [Environment]::SetEnvironmentVariable. Below I cover every way to set, get, persist … Read more

How to Run PowerShell as a Different User (3 Ways)

Run PowerShell as a different user

To run PowerShell as a different user, start a new PowerShell process with the other account’s credentials. The quickest way is Start-Process with Get-Credential, which asks for the password in a secure prompt: Below I check who you’re running as now, show every way to switch accounts, and explain how this differs from Run as … Read more

How to Delete User Profiles Using PowerShell in Windows 11

Delete user profiles using PowerShell in Windows 11

To delete user profiles using PowerShell in Windows 11, find the profile with Get-CimInstance Win32_UserProfile and pipe it to Remove-CimInstance in an elevated window. That removes the folder and the registry entry together: Deleting a profile can’t be undone, so below I list profiles safely, find stale ones and preview the removal with -WhatIf. I … Read more

How to Generate SSH Keys with PowerShell (ssh-keygen on Windows)

Generate SSH keys with PowerShell

To generate SSH keys with PowerShell, run ssh-keygen, which ships with Windows 10 and 11 as part of the built-in OpenSSH client. Ed25519 is the recommended key type: It asks where to save the key and for a passphrase, then creates a private key and a .pub public key. Below I check OpenSSH is installed, … Read more

How to Enable WinRM Using PowerShell (Enable-PSRemoting)

Enable WinRM using PowerShell

To enable WinRM using PowerShell, run Enable-PSRemoting in an elevated window. It starts the WinRM service, sets it to start automatically, creates a listener and opens the firewall: Before you run it, check the current state and the two things that usually make it fail: a Public network and missing firewall rules. I ran these … Read more