Most Viewed
Favorites
Recently Viewed
powershell Commands
Core
Get-Help
Displays information about PowerShell commands and concepts.
Get-Help
Examples:
Get help for the Get-Process commandGet-Help Get-Process
Get-Help Get-Process -Detailed
Get-Help Get-Process -Examples
Get-Command
Gets all commands that are installed on the computer, including cmdlets, aliases, functions, and workflows.
Get-Command
Examples:
Get all commandsGet-Command
Get-Command -Verb Get -Noun Service
Get-Command -Module Microsoft.PowerShell.Management
Process Management
Get-Process
Gets the processes that are running on the local computer.
Get-Process
Examples:
Get all running processesGet-Process
Get-Process -Name 'powershell'
Get-Process -Id 1234 | Format-List *
Stop-Process
Stops one or more running processes.
Stop-Process
Examples:
Stop a process by nameStop-Process -Name 'Notepad'
Stop-Process -Id 1234 -Force
System Management
Get-Service
Gets the services on a local or remote computer.
Get-Service
Examples:
Get all servicesGet-Service
Get-Service -Name win*
Get-Service -Name WinRM | Format-List *
Get-EventLog
Gets events in the classic event logs of a local or remote computer.
Get-EventLog
Examples:
Get the 10 newest entries from the System logGet-EventLog -LogName System -Newest 10
Get-EventLog -LogName Application -EntryType Error
Get-WmiObject
Gets instances of Windows Management Instrumentation (WMI) classes. (Legacy, use Get-CimInstance in newer PowerShell versions).
Get-WmiObject
Examples:
Get BIOS informationGet-WmiObject -Class Win32_BIOS
Get-WmiObject -Class Win32_OperatingSystem -ComputerName Server01
Get-CimInstance
Gets the CIM instances of a class from a CIM server. (Modern replacement for Get-WmiObject).
Get-CimInstance
Examples:
Get BIOS informationGet-CimInstance -ClassName Win32_BIOS
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property *
Security
Set-ExecutionPolicy
Changes the user preference for the PowerShell execution policy.
Set-ExecutionPolicy
Examples:
Set the execution policy to RemoteSigned for the current userSet-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Get-ExecutionPolicy -List
File System
Get-ChildItem
Gets the items and child items in one or more specified locations.
Get-ChildItem
Examples:
List items in the current directoryGet-ChildItem
Get-ChildItem -Path C:\Users\ -Recurse
Get-ChildItem -File -Force
Get-Content
Gets the content of the item at the specified location.
Get-Content
Examples:
Display the content of a fileGet-Content -Path .\MyFile.txt
Get-Content .\MyFile.txt -TotalCount 10
Get-Content .\MyLog.log -Tail 5 -Wait
Set-Content
Writes new content or replaces the content in a file.
Set-Content
Examples:
Create a new file with content (overwrites if exists)Set-Content -Path .\NewFile.txt -Value 'Hello, World!'
Set-Content -Path .\OldFile.txt -Value ''
Add-Content
Adds content to a specified item, such as a file.
Add-Content
Examples:
Append a line of text to a fileAdd-Content -Path .\Log.txt -Value 'New log entry'
Test-Path
Determines whether all elements of a path exist.
Test-Path
Examples:
Check if a file existsTest-Path -Path 'C:\Windows\System32\kernel32.dll'
Test-Path -Path 'C:\Windows' -PathType Container
Networking
Invoke-WebRequest
Gets content from a web page on the Internet.
Invoke-WebRequest
Examples:
Get a web pageInvoke-WebRequest -Uri 'https://www.google.com'
Invoke-WebRequest -Uri 'https://example.com/file.zip' -OutFile '.\file.zip'
$body = @{ key = 'value' } | ConvertTo-Json; Invoke-WebRequest -Uri 'https://api.example.com/items' -Method POST -Body $body -ContentType 'application/json'
Invoke-RestMethod
Sends an HTTP or HTTPS request to a RESTful web service and parses the response.
Invoke-RestMethod
Examples:
Get data from a public REST APIInvoke-RestMethod -Uri 'https://jsonplaceholder.typicode.com/todos/1'
$body = @{ title = 'foo'; body = 'bar'; userId = 1 } | ConvertTo-Json; Invoke-RestMethod -Uri 'https://jsonplaceholder.typicode.com/posts' -Method POST -Body $body -ContentType 'application/json'