Zero-XAtlasHelp

PowerShell quick help

Everyday commands for checking and repairing Windows. Type to filter, pick a topic, or click a column heading to sort. "Elevated" means a PowerShell window opened with Run as administrator.

54 commands
TopicCommandWhat it doesExampleElevated?
Getting aroundGet-HelpShows help for a command. Add -Examples for short worked examples, -Online to open the web page.Get-Help Get-Service -ExamplesNo
Getting aroundGet-CommandFinds commands by name or by the noun they work on.Get-Command *Service*No
Getting aroundGet-MemberLists the properties and methods of whatever you pipe in. Use it to learn what you can ask an object for.Get-Service | Get-MemberNo
Getting aroundStart-Process -Verb RunAsOpens a program in an elevated window. Use it to get an administrator PowerShell from a normal one.Start-Process powershell -Verb RunAsNo
Getting aroundStart-TranscriptRecords everything you type and see to a text file. Stop with Stop-Transcript.Start-Transcript -Path $env:TEMP\session.logNo
Shaping outputWhere-ObjectKeeps only the items that pass a test.Get-Service | Where-Object Status -eq RunningNo
Shaping outputSelect-ObjectPicks columns, or the first or last few items.Get-Process | Select-Object -First 5 Name, IdNo
Shaping outputSort-ObjectSorts by one or more properties. -Descending reverses the order.Get-Process | Sort-Object CPU -DescendingNo
Shaping outputMeasure-ObjectCounts items, or adds up a number property.Get-ChildItem -Recurse -File | Measure-Object Length -SumNo
Shaping outputFormat-TableShows results as a table. -AutoSize fits the columns to the data.Get-Service | Format-Table Name, Status -AutoSizeNo
Shaping outputExport-CsvSaves objects to a CSV file you can open in a spreadsheet.Get-Service | Export-Csv services.csv -NoTypeInformationNo
ServicesGet-ServiceLists services and whether they are running. Wildcards work in the name.Get-Service wuauservNo
ServicesStart-ServiceStarts a stopped service.Start-Service wuauservYes
ServicesStop-ServiceStops a running service. -Force also stops services that depend on it.Stop-Service wuauservYes
ServicesRestart-ServiceStops a service and starts it again.Restart-Service wuauservYes
ServicesSet-ServiceChanges how a service starts: Automatic, Manual or Disabled.Set-Service wuauserv -StartupType ManualYes
ProcessesGet-ProcessLists running programs with their CPU time and memory.Get-Process | Sort-Object WS -Descending | Select-Object -First 10No
ProcessesStop-ProcessEnds a program. Use the Id from Get-Process when more than one has the same name.Stop-Process -Id 1234Sometimes
Event logsGet-WinEventReads the Windows event logs. Without a filter it reads everything, so limit it.Get-WinEvent -LogName System -MaxEvents 20Sometimes
Event logsGet-WinEvent -FilterHashtableThe fast way to filter events: by log, level (2 is Error, 3 is Warning) and start time.Get-WinEvent -FilterHashtable @{LogName='System'; Level=2; StartTime=(Get-Date).AddDays(-1)}Sometimes
Event logsGet-WinEvent -ListLogLists the logs on the computer with their size and record count.Get-WinEvent -ListLog * | Where-Object RecordCount -gt 0Sometimes
NetworkTest-NetConnectionChecks whether a computer answers and whether a TCP port is open.Test-NetConnection server01 -Port 443No
NetworkResolve-DnsNameLooks up a name in DNS. -Type picks the record type.Resolve-DnsName example.com -Type ANo
NetworkGet-NetIPConfigurationShows each network adapter with its address, gateway and DNS servers.Get-NetIPConfigurationNo
NetworkGet-NetAdapterLists network adapters and their link state and speed.Get-NetAdapter | Where-Object Status -eq UpNo
NetworkGet-NetTCPConnectionLists TCP connections and listening ports, with the owning process id.Get-NetTCPConnection -State Listen | Sort-Object LocalPortNo
NetworkClear-DnsClientCacheEmpties the local DNS cache after a record has changed.Clear-DnsClientCacheYes
Disks and storageGet-VolumeLists volumes with free space, file system and health.Get-Volume | Select-Object DriveLetter, FileSystem, SizeRemaining, SizeNo
Disks and storageGet-PhysicalDiskShows each physical disk's health and operational status.Get-PhysicalDisk | Select-Object FriendlyName, HealthStatus, OperationalStatusNo
Disks and storageRepair-Volume -ScanScans a volume for file system errors while it is in use. Reports problems and changes nothing.Repair-Volume -DriveLetter C -ScanYes
Updates and servicingGet-HotFixLists installed updates. Give an id to check for one update.Get-HotFix -Id KB5000000No
Updates and servicingGet-WindowsUpdateLogTurns the binary Windows Update logs into one readable text file (default: WindowsUpdate.log on the desktop).Get-WindowsUpdateLog -LogPath $env:TEMP\WindowsUpdate.logYes
Updates and servicingRepair-WindowsImage -ScanHealthLooks for corruption in the component store (the DISM scan). Changes nothing.Repair-WindowsImage -Online -ScanHealthYes
Updates and servicingRepair-WindowsImage -RestoreHealthRepairs the component store, using Windows Update as the source unless you give one. Can take a long time.Repair-WindowsImage -Online -RestoreHealthYes
Updates and servicingsfc /scannowChecks system files against the component store and replaces damaged ones. A program, not a cmdlet. Run it after the repair above.sfc /scannowYes
Updates and servicingGet-WindowsOptionalFeatureLists Windows features and whether they are enabled.Get-WindowsOptionalFeature -Online | Where-Object State -eq EnabledYes
Files and permissionsGet-ChildItemLists files and folders. -Recurse goes into subfolders, -File skips folders.Get-ChildItem C:\Windows\Logs -Recurse -File | Sort-Object Length -Descending | Select-Object -First 10No
Files and permissionsGet-ContentReads a text file. -Tail shows the last lines and -Wait keeps following a log as it grows.Get-Content C:\Windows\Logs\CBS\CBS.log -Tail 50Sometimes
Files and permissionsSelect-StringSearches text files for a word or pattern and shows the matching lines.Select-String -Path C:\Windows\Logs\CBS\CBS.log -Pattern 'Error'Sometimes
Files and permissionsGet-AclShows who owns a file or folder and who may use it.Get-Acl C:\Windows\WinSxS | Format-ListNo
Files and permissionsGet-FileHashComputes a file's checksum, to check a download against the published value.Get-FileHash .\file.iso -Algorithm SHA256No
Files and permissionsTest-PathSays whether a file, folder or registry key exists.Test-Path C:\Windows\SoftwareDistributionNo
This computerGet-ComputerInfoReports Windows edition, version, build, uptime, memory and more in one object.Get-ComputerInfo | Select-Object OsName, OsVersion, OsBuildNumberNo
This computerGet-CimInstanceReads system information from WMI classes, such as the operating system or the BIOS.Get-CimInstance Win32_OperatingSystem | Select-Object Caption, LastBootUpTimeNo
This computerGet-ItemProperty (registry)Reads registry values. The HKLM: and HKCU: drives work like folders.Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' | Select-Object ProductName, CurrentBuild, UBRNo
This computerRestart-ComputerRestarts the computer. -Force closes programs without asking.Restart-ComputerYes
This computerGet-LocalGroupMemberLists who is in a local group, for example Administrators.Get-LocalGroupMember -Group AdministratorsYes
Remote computersTest-WSManChecks that a computer accepts PowerShell remoting (WinRM, port 5985).Test-WSMan server01No
Remote computersEnter-PSSessionOpens an interactive prompt on another computer. Leave with Exit-PSSession.Enter-PSSession -ComputerName server01Sometimes
Remote computersInvoke-CommandRuns a command on one or more computers and brings the results back.Invoke-Command -ComputerName server01 -ScriptBlock { Get-Service wuauserv }Sometimes
Scripts and safetyGet-ExecutionPolicyShows which scripts PowerShell will run. -List shows each scope.Get-ExecutionPolicy -ListNo
Scripts and safetySet-ExecutionPolicy -Scope ProcessLets scripts run in this window only; it ends when you close it. A guard against mistakes, not a security boundary.Set-ExecutionPolicy -Scope Process -ExecutionPolicy BypassNo
Scripts and safetyUnblock-FileRemoves the downloaded-from-the-internet mark from a script you have checked.Unblock-File .\script.ps1No
Scripts and safetyGet-AuthenticodeSignatureShows whether a script is signed and whether the signature is valid.Get-AuthenticodeSignature .\script.ps1No