PowerShell Cheatsheet
PowerShell commands with params - little ref
Page content
Here’s a little cheatsheet: PowerShell main commands with params
This awesomely powerfull seashell image is produced by AI model Flux 1 dev.
Basic Commands
Get-Command
: Lists all available commandsGet-Help <cmdlet>
: Displays help information for a specific cmdletGet-Process
: Lists all running processesGet-Service
: Lists all servicesGet-ChildItem
(alias:ls
,dir
): Lists items in the current directorySet-Location
(alias:cd
): Changes the current directoryClear-Host
(alias:cls
): Clears the console screen
File and Directory Management
New-Item
(alias:ni
): Creates a new file or directoryCopy-Item
: Copies files and directoriesMove-Item
: Moves files and directoriesRemove-Item
(alias:rm
): Deletes files and directoriesRename-Item
(alias:rnp
): Renames a file or directoryGet-Content
(alias:gc
): Displays the content of a file
System Administration
Start-Process
(alias:saps
): Starts one or more processesStop-Process
: Stops one or more running processesStart-Service
: Starts one or more servicesStop-Service
: Stops one or more running servicesRestart-Computer
: Restarts the computerGet-WinEvent
: Displays Windows event logsCheckpoint-Computer
: Sets a restore point on your machine
Network Commands
Test-Connection
: Sends ICMP echo request packets to one or more computersInvoke-WebRequest
(alias:curl
,wget
): Gets content from a web pageGet-NetAdapter
: Retrieves network adaptersGet-NetIPAddress
: Gets IP address configuration
User and Security Management
Get-LocalUser
: Lists local user accountsNew-LocalUser
: Creates a new local user accountSet-LocalUser
: Modifies a local user accountRemove-LocalUser
: Deletes a local user accountGet-Acl
: Gets the security descriptor for a resource
PowerShell Scripting
Set-ExecutionPolicy
: Sets the PowerShell execution policyGet-Variable
: Gets the variables in the current consoleSet-Variable
(alias:set
,sv
): Sets a variable’s valueRemove-Variable
(alias:rv
): Deletes a variableForEach-Object
: Performs an operation on each item in a specified collectionWhere-Object
: Selects objects with specific properties
Job Management
Start-Job
(alias:sajb
): Starts a PowerShell background jobGet-Job
: Gets PowerShell background jobs running in the current sessionReceive-Job
: Gets the results of background jobsStop-Job
: Stops a PowerShell background jobWait-Job
: Waits until one or all of the PowerShell background jobs are complete
Output Formatting
Format-Table
: Formats output as a tableFormat-List
: Formats output as a listOut-File
: Sends output to a fileExport-Csv
: Exports objects to a CSV fileConvertTo-Json
: Converts an object to a JSON-formatted string
Use Get-Help <cmdlet>
for detailed information on any command, including its parameters and usage examples.
Useful links
- https://en.wikipedia.org/wiki/PowerShell
- https://devblogs.microsoft.com/scripting/table-of-basic-powershell-commands/
- https://download.microsoft.com/download/2/1/2/2122f0b9-0ee6-4e6d-bfd6-f9dcd27c07f9/ws12_quickref_download_files/powershell_langref_v3.pdf