Appendix A — Top 100 PowerShell Commands for Windows Server Administrators
1. PowerShell Basics and Help — 1 to 10
| # | PowerShell Command | Purpose |
|---|
| 1 | Get-Help | Displays help for cmdlets |
| 2 | Get-Command | Lists available commands |
| 3 | Get-Member | Shows properties and methods of an object |
| 4 | Get-Alias | Lists PowerShell aliases |
| 5 | Get-Module | Lists loaded modules |
| 6 | Import-Module | Imports a PowerShell module |
| 7 | Get-ExecutionPolicy | Displays the current script execution policy |
| 8 | Set-ExecutionPolicy | Changes the execution policy |
| 9 | Get-History | Displays command history |
| 10 | Clear-History | Clears PowerShell command history |
2. System Information — 11 to 20
| # | PowerShell Command | Purpose |
|---|
| 11 | Get-ComputerInfo | Displays detailed computer information |
| 12 | Get-CimInstance Win32_OperatingSystem | Displays OS information |
| 13 | Get-CimInstance Win32_ComputerSystem | Displays computer hardware information |
| 14 | Get-CimInstance Win32_BIOS | Displays BIOS information |
| 15 | Get-CimInstance Win32_Processor | Displays CPU information |
| 16 | Get-HotFix | Lists installed Windows updates |
| 17 | Get-Date | Displays the current date and time |
| 18 | Get-TimeZone | Displays the configured time zone |
| 19 | Get-Uptime | Displays system uptime |
| 20 | Restart-Computer | Restarts a local or remote computer |
3. Services and Processes — 21 to 30
| # | PowerShell Command | Purpose |
|---|
| 21 | Get-Service | Lists Windows services |
| 22 | Start-Service | Starts a service |
| 23 | Stop-Service | Stops a service |
| 24 | Restart-Service | Restarts a service |
| 25 | Set-Service | Changes service configuration |
| 26 | Get-Process | Lists running processes |
| 27 | Stop-Process | Terminates a process |
| 28 | Start-Process | Starts an application or process |
| 29 | Wait-Process | Waits for a process to stop |
| 30 | Get-ScheduledTask | Lists scheduled tasks |
4. Files and Folders — 31 to 40
| # | PowerShell Command | Purpose |
|---|
| 31 | Get-ChildItem | Lists files and folders |
| 32 | Set-Location | Changes the current directory |
| 33 | New-Item | Creates a file or folder |
| 34 | Copy-Item | Copies files or folders |
| 35 | Move-Item | Moves files or folders |
| 36 | Remove-Item | Deletes files or folders |
| 37 | Rename-Item | Renames a file or folder |
| 38 | Get-Content | Reads file content |
| 39 | Set-Content | Replaces file content |
| 40 | Add-Content | Appends content to a file |
5. Networking — 41 to 50
| # | PowerShell Command | Purpose |
|---|
| 41 | Get-NetIPAddress | Displays IP addresses |
| 42 | New-NetIPAddress | Configures a new IP address |
| 43 | Remove-NetIPAddress | Removes an IP address |
| 44 | Get-NetAdapter | Lists network adapters |
| 45 | Enable-NetAdapter | Enables a network adapter |
| 46 | Disable-NetAdapter | Disables a network adapter |
| 47 | Get-NetIPConfiguration | Displays network configuration |
| 48 | Test-Connection | Tests network connectivity |
| 49 | Test-NetConnection | Tests host and TCP port connectivity |
| 50 | Resolve-DnsName | Performs DNS resolution |
6. Active Directory — 51 to 65
Requires the Active Directory PowerShell module.
| # | PowerShell Command | Purpose |
|---|
| 51 | Get-ADUser | Retrieves AD users |
| 52 | New-ADUser | Creates an AD user |
| 53 | Set-ADUser | Modifies an AD user |
| 54 | Remove-ADUser | Deletes an AD user |
| 55 | Enable-ADAccount | Enables an AD account |
| 56 | Disable-ADAccount | Disables an AD account |
| 57 | Unlock-ADAccount | Unlocks a locked AD account |
| 58 | Set-ADAccountPassword | Resets an AD password |
| 59 | Get-ADGroup | Retrieves AD groups |
| 60 | New-ADGroup | Creates an AD group |
| 61 | Add-ADGroupMember | Adds members to an AD group |
| 62 | Remove-ADGroupMember | Removes members from an AD group |
| 63 | Get-ADComputer | Retrieves AD computer objects |
| 64 | Get-ADDomain | Displays domain information |
| 65 | Get-ADForest | Displays forest information |
7. DNS and DHCP — 66 to 75
| # | PowerShell Command | Purpose |
|---|
| 66 | Get-DnsServerZone | Lists DNS zones |
| 67 | Get-DnsServerResourceRecord | Lists DNS records |
| 68 | Add-DnsServerResourceRecordA | Creates an A record |
| 69 | Remove-DnsServerResourceRecord | Removes a DNS record |
| 70 | Clear-DnsClientCache | Clears the DNS client cache |
| 71 | Get-DhcpServerv4Scope | Lists DHCP scopes |
| 72 | Add-DhcpServerv4Scope | Creates a DHCP scope |
| 73 | Get-DhcpServerv4Lease | Lists DHCP leases |
| 74 | Add-DhcpServerv4Reservation | Creates a DHCP reservation |
| 75 | Get-DhcpServerv4Failover | Displays DHCP failover configuration |
8. Windows Server Roles and Features — 76 to 80
| # | PowerShell Command | Purpose |
|---|
| 76 | Get-WindowsFeature | Lists Windows Server roles and features |
| 77 | Install-WindowsFeature | Installs roles and features |
| 78 | Uninstall-WindowsFeature | Removes roles and features |
| 79 | Get-WindowsCapability | Lists Windows capabilities |
| 80 | Add-WindowsCapability | Installs a Windows capability |
9. Storage and Disk Management — 81 to 90
| # | PowerShell Command | Purpose |
|---|
| 81 | Get-Disk | Lists physical disks |
| 82 | Initialize-Disk | Initializes a disk |
| 83 | Get-Partition | Lists partitions |
| 84 | New-Partition | Creates a partition |
| 85 | Resize-Partition | Resizes a partition |
| 86 | Get-Volume | Lists volumes |
| 87 | Format-Volume | Formats a volume |
| 88 | Get-PhysicalDisk | Lists physical disks used by Storage Spaces |
| 89 | Get-StoragePool | Lists storage pools |
| 90 | New-StoragePool | Creates a storage pool |
10. Logs, Security, Hyper-V and Remote Management — 91 to 100
| # | PowerShell Command | Purpose |
|---|
| 91 | Get-WinEvent | Reads Windows event logs |
| 92 | Get-Acl | Displays file or registry permissions |
| 93 | Set-Acl | Changes permissions |
| 94 | Get-BitLockerVolume | Displays BitLocker status |
| 95 | Get-VM | Lists Hyper-V virtual machines |
| 96 | Start-VM | Starts a Hyper-V VM |
| 97 | Stop-VM | Stops a Hyper-V VM |
| 98 | Enable-PSRemoting | Enables PowerShell remoting |
| 99 | Enter-PSSession | Opens an interactive remote PowerShell session |
| 100 | Invoke-Command | Executes commands on remote computers |
Essential PowerShell examples
# Find stopped services
Get-Service | Where-Object Status -eq "Stopped"
# Test whether RDP port 3389 is reachable
Test-NetConnection -ComputerName SRV01 -Port 3389
# Find enabled AD users
Get-ADUser -Filter * -Properties Enabled |
Where-Object Enabled -eq $true
# Find locked AD accounts
Search-ADAccount -LockedOut
# Check installed server roles
Get-WindowsFeature | Where-Object InstallState -eq "Installed"
# Check recent System events
Get-WinEvent -LogName System -MaxEvents 20
# Run a command remotely
Invoke-Command -ComputerName SRV01 -ScriptBlock {
Get-Service
}
Comments
Post a Comment