PS

Top 100 PowerShell Commands

Cheat Sheet  ·  Windows / Cross-Platform

⚙️1. Process Management
1
Get-ProcessGet running processes
2
Stop-ProcessStop a process
3
Start-ProcessStart a process
4
Get-Process -IdGet process by ID
5
Get-Process | Sort-Object CPU -DescSort processes by CPU usage
6
Get-Process | Sort-Object PM -DescSort processes by memory usage
7
Get-Process -Name notepadGet process by name
8
Stop-Process -Name notepadStop process by name
9
Get-ChildProcessGet child processes
10
Wait-ProcessWait for a process to exit
🔧2. Service Management
11
Get-ServiceList all services
12
Start-ServiceStart a service
13
Stop-ServiceStop a service
14
Restart-ServiceRestart a service
15
Get-Service -Name SpoolerGet service by name
16
Set-Service -Name Spooler -StartupType AutomaticSet service startup type
17
Get-Service | Where-Object {$_.Status -eq 'Running'}Get running services
18
Get-Service | Where-Object {$_.Status -eq 'Stopped'}Get stopped services
19
Suspend-Service -Name NameSuspend a service
20
Resume-Service -Name NameResume a service
🌐3. Networking
21
Get-NetIPAddressGet IP address info
22
Get-NetIPConfigurationGet IP configuration
23
Test-Connection google.comPing a host
24
Test-NetConnection google.com -Port 443Test port connectivity
25
Get-NetTCPConnectionGet TCP connections
26
Get-NetUDPEndpointGet UDP endpoints
27
Get-DnsClientServerAddressGet DNS server address
28
ipconfig /allShow IP configuration
29
Get-NetAdapterGet network adapters
30
Disable-NetAdapter -Name "Ethernet"Disable network adapter
👥4. Active Directory
31
Get-ADUser -Filter *List all AD users
32
Get-ADUser -Identity usernameGet user details
33
New-ADUser -Name "John Doe" -SamAccountName jdoe -AccountPassword (...) -Enabled $trueCreate new AD user
34
Set-ADUser -Identity jdoe -Title "IT Support"Update AD user
35
Disable-ADAccount -Identity jdoeDisable AD account
36
Enable-ADAccount -Identity jdoeEnable AD account
37
Remove-ADUser -Identity jdoeRemove AD user
38
Get-ADGroup -Filter *List all AD groups
39
Add-ADGroupMember -Identity "IT Support" -Members jdoeAdd user to group
40
Get-ADComputer -Filter *List all AD computers
📁5. File Management
41
Get-ChildItemList files and folders
42
Set-LocationChange directory
43
Copy-ItemCopy files or folders
44
Move-ItemMove files or folders
45
Remove-ItemDelete files or folders
46
Rename-ItemRename files or folders
47
New-Item -ItemType File -Path "C:\Temp\test.txt"Create new file
48
New-Item -ItemType Directory -Path "C:\Temp\NewFolder"Create new folder
49
Get-ContentRead file contents
50
Set-ContentWrite content to file
📋6. Event Logs
51
Get-EventLog -LogName System -Newest 10Get latest 10 system log entries
52
Get-EventLog -LogName Application -Newest 10Get latest 10 application logs
53
Get-WinEvent -LogName System -MaxEvents 10Get latest system events
54
Get-WinEvent -FilterHashtable @{LogName='Security'; ID=4624}Filter system logon events
55
Clear-EventLog -LogName ApplicationClear application log
56
Get-EventViewerLogList all event logs
57
Get-WinEvent -ListLog *Get all event logs (detailed)
58
Get-WinEvent -FilterHashtable @{EntryType='Error'}Get all errors from system log
59
Get-WinEvent -FilterHashtable @{Level=2}Get critical events
60
Export-EventLog -LogName System -FilePath "C:\System.evtx"Export event log
💻7. System Information
61
Get-ComputerInfoGet system information
62
Get-WmiObject Win32_OperatingSystemGet OS information
63
Get-WmiObject Win32_ComputerSystemGet computer system info
64
[Environment]::OSVersionGet OS version
65
Get-HotFixGet installed updates
66
Get-PSDriveGet PS drives
67
Get-DiskGet disk information
68
Get-VolumeGet volume information
69
Get-CimInstance Win32_BIOSGet BIOS information
70
Get-UptimeGet system uptime
🖧8. Remote Administration
71
Invoke-Command -ComputerName Server01 {ipconfig}Run command on remote computer
72
Enter-PSSession -ComputerName Server01Start remote session
73
Get-PSSessionList active sessions
74
New-PSSession -ComputerName Server01Create new session
75
Copy-Item "C:\file.txt" -Destination "C:\Temp" -ToSession (New-PSSession Server01)Copy file to remote computer
76
Invoke-Command -ComputerName Server01 -FilePath "C:\Scripts\script.ps1"Run remote script
77
Get-Command -ComputerName Server01Run Get-Command on remote
78
Restart-Computer -ComputerName Server01Restart remote computer
79
Stop-Computer -ComputerName Server01Shutdown remote computer
80
Test-WSMan -ComputerName Server01Test WinRM connectivity
📧9. Microsoft 365 / Exchange
81
Connect-ExchangeOnlineConnect to Exchange Online
82
Get-MailboxGet all mailboxes
83
Get-Mailbox -Identity user@domain.comGet mailbox details
84
Enable-Mailbox -Identity user@domain.comEnable a mailbox
85
Disable-Mailbox -Identity user@domain.comDisable a mailbox
86
Set-Mailbox -Identity user@domain.com -DeliverToMailboxAndForward $trueSet mailbox forwarding
87
Get-MsolUser -AllList all Microsoft 365 users
88
Get-MsolGroup -AllList Microsoft 365 groups
89
Get-MsolUser -UserPrincipalName user@domain.com -BlockCredential $trueBlock user sign-in
90
Remove-MsolUser -UserPrincipalName user@domain.comRemove Microsoft 365 user
</>10. Automation & Scripting
91
Get-CommandGet all commands
92
Get-Command -Module ModuleNameGet commands in module
93
Get-ModuleList imported modules
94
Import-Module -Name ModuleNameImport a module
95
Get-HistoryGet command history
96
Clear-HistoryClear command history
97
Start-Transcript -Path "C:\log.txt"Start logging session
98
Stop-TranscriptStop logging
99
Write-Output "Hello World"Output text
100
Write-Host "Hello World" -ForegroundColor GreenOutput text in color
💡 Tips for Using PowerShell
Run as Administrator for full access.
Use Tab key for auto-completion.
Use Get-Help <Command> for detailed help.
Use Get-Command *keyword* to find related commands.
Use pipelines (|) to pass results from one command to another.
Example Pipelines
Get-Process | Where-Object {$_.CPU -gt 100} | Sort-Object CPU -Desc
Get-Service | Where-Object {$_.Status -eq 'Running'}
Get-ChildItem C:\ | Where-Object {$_.Length -gt 1MB}
Get-EventLog -LogName Application -EntryType Error -Newest 20