PowerShell: Get the Current Logged-On User on a Remote Computer

Get the current logged-on user on a remote computer with PowerShell

To get the current logged-on user on a remote computer with PowerShell, read the UserName property of Win32_ComputerSystem with Get-CimInstance: It returns DOMAIN\user for whoever is signed in at the console. Below I test the same queries on my own PC, show the two remoting errors you’ll most likely hit, and cover Remote Desktop sessions … Read more

Why Does Windows PowerShell Keep Popping Up? (Find and Fix It)

Why Windows PowerShell keeps popping up

Windows PowerShell keeps popping up because something on your PC is starting it: usually a scheduled task, a startup entry, or an app or management script running in the background. Occasionally it’s malware. The fix is to find what launches it. Below I show three read-only checks that do exactly that, then how to stop … Read more

How to Update PowerShell on Windows 11 (winget, MSI or Store)

Update PowerShell on Windows 11

To update PowerShell on Windows 11, run winget upgrade for the PowerShell package. It installs the newest PowerShell 7 release over your current one: Before you run it, check which version you have and how it was installed, because Microsoft recommends upgrading with the same method. I walk through both checks below, plus the MSI, … Read more

How to Uninstall a Program with PowerShell (4 Methods)

Uninstall a program with PowerShell

To uninstall a program with PowerShell, the simplest way on Windows 10 and 11 is winget. Find the program’s ID, then uninstall it silently: Below I show three more methods: Uninstall-Package, msiexec with the product code, and the program’s own uninstall string. For safety, my examples find and preview the uninstall without removing anything. Find … Read more

How to Enable Remote Desktop Using PowerShell (Local and Remote)

Enable Remote Desktop using PowerShell

To enable Remote Desktop using PowerShell, set fDenyTSConnections to 0 in the registry and turn on the Remote Desktop firewall rules. Run both lines as administrator: Below I check the current state first, then cover NLA, allowing users, enabling RDP on remote PCs and turning it off again. The checks ran on Windows 11 in … Read more

How to List All Environment Variables in PowerShell

List all environment variables in PowerShell

To list all environment variables in PowerShell, run Get-ChildItem on the Env: drive. Sorting by name makes the list easy to scan: Below I show how to read the output, pick out single variables, filter with wildcards, compare the Process, User and Machine scopes, and split PATH into readable lines. I tested it all in … Read more

How to Check if a Port Is Open Using PowerShell (Fast Methods)

Check if a port is open using PowerShell

To check if a port is open using PowerShell, run Test-NetConnection with the host name and port. -InformationLevel Quiet returns just True or False: Output: That’s perfect for one check, but it can take 20 seconds or more when the port is closed. Below I show a faster check with a timeout, a reusable function, … Read more

How to Check for Windows Updates Using PowerShell

Check for Windows updates using PowerShell

To check for Windows updates using PowerShell, ask the built-in Windows Update Agent to search. It needs no extra module and no admin rights: Below I list what’s waiting with KB numbers, show when Windows last checked, find where updates come from and check other PCs. I ran each check in PowerShell 7.6 and Windows … Read more

Fix: The File Is Not Digitally Signed. You Cannot Run This Script

Fix the file is not digitally signed error in PowerShell

The “file is not digitally signed. You cannot run this script on the current system” error means your execution policy only runs signed scripts, and this one isn’t signed. For a script you trust, the quickest fix is to unblock it: Below I reproduce the error, show why it happens, and walk through four fixes … Read more

How to Install .NET Framework 3.5 Using PowerShell (Online and Offline)

Install .NET Framework 3.5 using PowerShell

To install .NET Framework 3.5 using PowerShell, enable the NetFx3 Windows feature in an elevated window. Windows downloads the files from Windows Update: That works on Windows 11 25H2 and earlier, Windows 10 and Windows Server. Windows 11 26H1 and later need a separate installer instead. Below I cover checking, installing online and offline, and … Read more