Applies to: PowerShell 7.6 and Windows PowerShell 5.1 on Windows Server 2025 and Windows 10 or 11
PowerShell is Windows’ command shell and scripting language. Its commands (“cmdlets”) are named Verb-Noun, such as Get-Process, and they pass objects instead of plain text, so you can filter and sort results easily. We ran the cross-platform commands below on PowerShell 7.6.6; the Windows-only ones follow Microsoft’s documentation.
Which PowerShell do you have?
- Windows PowerShell 5.1 is built into Windows and Windows Server (
powershell.exe). - PowerShell 7 (
pwsh.exe) is installed separately and runs side by side with 5.1. 7.6 is the current long-term support release. On Windows Server 2025 with Desktop Experience, or Windows 11:winget install --id Microsoft.PowerShell --source winget. For servers, Microsoft recommends the MSI package (add--installer-type wix). - Check the version:
$PSVersionTable.PSVersion
Help and discovery
Get-Help Get-Process -Examples Get-Command *service* Get-Alias dir # dir, ls and cat are aliases for PowerShell cmdlets on Windows
Files and folders
Get-ChildItem C:\inetpub -Recurse -Filter *.config Set-Location C:\Temp New-Item -ItemType Directory -Path C:\Backup Copy-Item .\app.log C:\Backup\ Move-Item .\old.txt .\archive\ Remove-Item .\temp -Recurse Get-Content .\app.log -Tail 20 # last 20 lines Get-Content .\app.log -Wait -Tail 5 # follow a log, like tail -f Select-String -Path .\app.log -Pattern "error" # like grep
Select-String ignores upper and lower case by default: in our test it found both error: disk full and ERROR: timeout; with -CaseSensitive only the first.
Processes and services
Get-Process | Sort-Object CPU -Descending | Select-Object -First 10 Name, Id, CPU Stop-Process -Name notepad Get-Service | Where-Object Status -eq Running Restart-Service -Name W3SVC # IIS Get-Service -Name TermService # Remote Desktop
Network
Get-NetIPAddress -AddressFamily IPv4 Test-NetConnection example.com -Port 443 Resolve-DnsName example.com Invoke-WebRequest -Uri https://example.com -Method Head
System and logs
Get-ComputerInfo | Select-Object OsName, OsVersion, CsTotalPhysicalMemory Get-HotFix | Sort-Object InstalledOn -Descending | Select-Object -First 5 Get-WinEvent -LogName System -MaxEvents 20 Get-LocalUser Restart-Computer
Filter, sort and export
Get-ChildItem C:\Logs -File | Where-Object Length -gt 100MB | Sort-Object Length -Descending Get-Process | Export-Csv C:\Temp\processes.csv -NoTypeInformation
“Running scripts is disabled on this system”: the execution policy
The execution policy decides whether PowerShell may run script files (.ps1). According to Microsoft, when no policy is set, Windows 10 and 11 use Restricted (no scripts) and Windows Server uses RemoteSigned (your own scripts run; scripts downloaded from the internet must be signed or unblocked).
Get-ExecutionPolicy -List Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser Unblock-File -Path .\script.ps1 # a downloaded script you trust
The execution policy is a safety net, not a security boundary. On Linux and macOS it is always Unrestricted (our test confirmed this) and can’t be changed.
cmd or PowerShell?
The old Command Prompt (cmd.exe) still works for simple commands, but new Windows administration tools are written for PowerShell. Most cmd commands such as ipconfig or ping also work inside PowerShell.
Run your own Windows server: Windows VPS. Connecting to it: Remote Desktop.
Official documentation: Microsoft: about execution policies and install PowerShell on Windows.
Ucartz services for this topic
- Hire an expert: engineers per 15 minutes, per hour or per month, with no contract.
- Server management: on-demand administration, hardening, migrations and monitoring.
