PowerShell is one of the most powerful tools available to Windows Server administrators. Whether you’re managing users, monitoring services, or automating repetitive tasks, PowerShell can save you hours of manual effort.
In this guide, I’ll walk you through the Top 10 PowerShell commands every Windows Server admin should know, complete with examples and real-world use cases.
What is PowerShell?
PowerShell is Microsoft’s task automation and configuration management framework, consisting of a command-line shell and a scripting language. Unlike traditional Command Prompt (CMD), PowerShell uses cmdlets (specialized commands) that are object-oriented and can be combined with pipelines to create powerful workflows.
It comes pre-installed on modern Windows Server versions, and the cross-platform PowerShell 7 is available for Linux and macOS as well.
Top 10 PowerShell Commands for Windows Admins
Below are the must-know commands for any Windows Server administrator:
1. Get-Help
– Your PowerShell Manual
Syntax:
Get-Help
Description: Displays detailed help for cmdlets, including usage and examples.
Use case:
Quickly learn how to use a command without Googling.
2. Get-Process
– Monitor Running Processes
Syntax:
Get-Process | Sort-Object CPU -Descending
Description: Lists all running processes.
Use case:
Identify processes consuming high CPU or memory.
3. Get-Service
– Manage Windows Services
Syntax:
Get-Service | Where-Object {$_.Status -eq "Stopped"}
Description: Lists Windows services and their status.
Use case:
Check if critical services are stopped.
4. Start-Service
/ Stop-Service
– Control Services
Syntax:
Start-Service -Name Spooler Stop-Service -Name Spooler
Description: Start or stop a Windows service.
Use case:
Restart the Print Spooler or other services remotely.
5. Get-EventLog
– View Event Logs
Syntax:
Get-EventLog -LogName System -Newest 20
Description: Retrieves event logs from the system.
Use case:
Troubleshoot errors, crashes, or warnings on a server.
6. Get-ADUser
– Query Active Directory Users
(Requires the ActiveDirectory module)
Syntax:
Get-ADUser -Filter * -SearchBase "OU=Users,DC=domain,DC=com"
Description: Retrieves user accounts from Active Directory.
Use case:
Audit users, find locked accounts, or export user lists.
7. Restart-Computer
– Reboot Servers Remotely
Syntax:
Restart-Computer -ComputerName Server01 -Force
Description: Restarts local or remote computers.
Use case:
Apply updates or patches without logging in manually.
8. Invoke-Command
– Run Remote Commands
Syntax:
Invoke-Command -ComputerName Server01 -ScriptBlock { Get-Service }
Description: Runs commands or scripts on remote computers.
Use case:
Manage multiple servers from one console.
9. Get-ChildItem
(gci
) – Browse Files & Folders
Syntax:
Get-ChildItem C:\Logs -Recurse
Description: Lists files and directories.
Use case:
Find large log files or audit file structures.
10. Set-ExecutionPolicy
– Control Script Execution
Syntax:
Set-ExecutionPolicy RemoteSigned
Description: Configures which scripts are allowed to run.
Use case:
Enable running of custom automation scripts.
Bonus Tip: Combining Cmdlets with Pipelines
PowerShell becomes incredibly powerful when you combine commands using pipelines (|
).
Example:
Get-Service | Where-Object {$_.Status -eq "Stopped"} | Start-Service
Get-Service | Where-Object {$_.Status -eq "Stopped"} | Start-Service
This command finds all stopped services and starts them automatically.
Best Practices for Using PowerShell
- Always test scripts in a non-production environment first.
- Use
-WhatIf
and-Confirm
parameters to avoid unintended actions. - Store and version-control your scripts using GitHub or Azure Repos.
- Use comments in scripts so future admins (or you!) can understand them later.
Conclusion
PowerShell is a must-have skill for Windows Server administrators. The commands above will help you manage processes, services, logs, Active Directory, and even remote servers more efficiently.
💡 The more you practice, the more you’ll discover how powerful PowerShell can be for automating daily admin tasks.
Want more PowerShell and DevOps tutorials? Subscribe to TechieRamesh for weekly updates on automation, cloud, and scripting!
FAQs
Q1: How do I learn PowerShell quickly?
Start with simple commands like Get-Help
, Get-Process
, and gradually move to scripting. Microsoft Learn and blogs like TechieRamesh are great resources.
Q2: Is PowerShell better than CMD?
Yes. PowerShell is object-oriented, supports automation, and is far more powerful than Command Prompt (CMD).
Q3: Can I use PowerShell on Linux?
Yes. PowerShell 7 is cross-platform and works on Linux and macOS.