Author: Peter Whyte
-
Get Your IP Address in PowerShell
Get your IP address in PowerShell with Get-NetIPAddress, find the one adapter that matters with the default route, see gateway and DNS with Get-NetIPConfiguration, and look up your public IP.
-
PowerShell curl: Why -Uri and -OutFile Stopped Working
In Windows PowerShell 5.1 curl is an alias for Invoke-WebRequest. In PowerShell 7 it is not, it runs curl.exe, and the old flags either error or sit there asking for a password. Here is what to run in each.
-
Install a WSL Distro on Another Drive
C: is full and WSL wants to put another virtual disk on it. The WSL install command has a location option that puts a new distro on any drive you choose. The command, the check that it landed there, and what to do about the distros already on C:.
-
PSReadLine Predictive IntelliSense: Show Suggestions as a List
Turn on PSReadLine predictive IntelliSense in PowerShell 7 with suggestions from your history shown as a list, keep it in your profile, and what Windows PowerShell 5.1 needs.
-
List Installed Programs with PowerShell
List installed programs with PowerShell from the Uninstall registry keys, search and export the list, use winget list for Store apps, and why Win32_Product is the one to avoid.
-
Copy Files to a Remote Host with PowerShell
Copy-Item has no -ComputerName parameter, which is why the command you copied off the internet fails. The working form is -ToSession with a PSSession, and here is how to do it for one host and for several.
-
Move a WSL Distro Off the C: Drive
A WSL distro is one big vhdx file, and by default it sits on C:. Move it to another drive with the WSL move command, or with export and import on older WSL, without losing what is inside it.
-
Get a File Hash in PowerShell (Verify a Download)
Get a file hash in PowerShell with Get-FileHash, compare it to the hash a publisher lists to verify a download, switch to MD5 or SHA512, and the algorithms PowerShell 7 dropped.
-
Find What Is Filling Your C: Drive with PowerShell
C: is nearly full and you do not know why. Read-only PowerShell commands to size every top-level folder, list the largest files, and check the usual culprits: WSL and Docker disks, temp folders, the Windows Update cache and the recycle bin.