PowerShell Shortcuts
5 categories ยท 29 shortcuts
01
Cmdlets
6 shortcuts- Show help for cmdletGet-Help
- List all commandsGet-Command
- List items (ls)Get-ChildItem
- Change directory (cd)Set-Location
- Copy item (cp)Copy-Item
- Remove item (rm)Remove-Item
02
Pipeline
6 shortcuts- Pipe output to next command|
- Select properties|Select-Object
- Filter objects|Where-Object
- Sort objects|Sort-Object
- Iterate objects|ForEach-Object
- Export to CSV|Export-Csv
03
Variables
6 shortcuts- Assign variable$var=value
- Access environment variable$env:PATH
- Current pipeline object$_
- Current pipeline object (alias)$PSItem
- List all variablesGet-Variable
- Delete variableRemove-Variable
04
Functions
5 shortcuts- Define functionfunctionName{}
- Declare parametersparam()
- Return valuereturn
- List functionsGet-Command-CommandTypeFunction
- Remove functionRemove-ItemFunction:Name
05
Remoting
6 shortcuts- Start interactive sessionEnter-PSSession
- End sessionExit-PSSession
- Run command remotelyInvoke-Command
- Create persistent sessionNew-PSSession
- List sessionsGet-PSSession
- Close sessionRemove-PSSession