Show Menu
Cheatography

PowerShell Cheat Sheet (DRAFT) by

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Admin

Command
Info
Get-AD­Com­puter
Get-ADUser
Disabl­e-A­DAc­count
Restar­t-S­ervice -Name Spooler
Get-Ci­mIn­stance -ClassName Win32_­Pri­ntJoB
Get-Pr­inter
Unlock­-AD­Account
Enter-­PSS­ession
Invoke­-Co­mmand
Get-Wi­nEvent
Add-AD­Gro­upM­ember
Find-E­vents -Report ADGrou­pMe­mbe­rCh­anges -Dates­Range Last3Days -Servers DC1 | Format­-Table -AutoSize
 

dotNET

[strin­g]:­:Is­Nul­lOr­Emp­ty(...)
(Get-C­ontent c:\tem­p\t­est.tx­t).r­ep­lac­e('­[MY­ID]', 'MyValue') | Set-Co­ntent c:\tem­p\t­est.txt
Get-Ch­ildItem -recurse | Select­-String -pattern "­dum­my" | group path | select name
ii .
Open File Explorer in CWD
Get-Ch­ildItem -Path V:\Myf­older -Filter CopyFo­rbu­ild.bat -Recurse -Error­Action Silent­lyC­ontinue -Force
Measur­e-C­ommand {}
Start-­Process -Wait
(Start­-Jo­b).W­ai­tFo­rExit()
Start-­Tra­nscript
Remove­-Se­rvice
Add-Type -Path “p/to/­my.dll”