PowerShell Basics for Windows Server Admins
An introduction to PowerShell for Windows Server administration, covering common cmdlets, execution policy, and remoting with Enable-PSRemoting and Invoke-Command.
25 November 2026 4 min read
PowerShell is the standard administration language for Windows Server, and every other post in this series leans on it. This post steps back to cover the fundamentals: how cmdlets are structured, what execution policy actually does, and how to run commands against remote servers instead of logging into each one individually.
Cmdlet structure
PowerShell cmdlets follow a consistent Verb-Noun naming pattern: Get-Service, Restart-Service, New-Item, Remove-Item. Once you know the pattern, you can often guess the cmdlet you need. To confirm, or to see what’s available on a particular topic:
Get-Command -Noun Service
Get-Help Get-Service -Full
Get-Help Get-Service -Examples
The output of most cmdlets is a structured object, not plain text, which is what makes PowerShell different from a traditional shell. That means you can pipe output into other cmdlets and filter or reshape it reliably:
Get-Service | Where-Object { $_.Status -eq 'Running' } | Sort-Object DisplayName
Cmdlets you’ll use constantly
| Cmdlet | Purpose |
|---|---|
| Get-Service / Start-Service / Stop-Service | Query and control Windows services |
| Get-Process / Stop-Process | Query and end running processes |
| Get-EventLog / Get-WinEvent | Read Windows event logs |
| Get-ChildItem | List files and folders (like dir or ls) |
| Test-NetConnection | Test connectivity to a host and port |
| Get-NetIPConfiguration | View network adapter and IP configuration |
| Restart-Computer | Restart the local or a remote machine |
Execution policy
Execution policy controls whether PowerShell scripts (.ps1 files) are allowed to run on a machine. It’s a safety mechanism aimed at accidental script execution, not a security boundary against a determined attacker, since it can be bypassed in several documented ways. Common values:
- Restricted: no scripts can run at all. This is the default on client Windows.
- AllSigned: only scripts signed by a trusted publisher can run.
- RemoteSigned: locally created scripts run freely; scripts downloaded from the internet must be signed. This is the default on Windows Server.
- Unrestricted: all scripts run, with a warning for internet-sourced ones.
To check and set the current policy:
Get-ExecutionPolicy
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
RemoteSigned is a sensible default for most servers: it lets you write and run your own maintenance scripts without friction, while still requiring a signature on anything pulled from outside.
PowerShell remoting
Remoting lets you run commands on another Windows Server from your own machine, which is the difference between administering one server and administering a fleet. It runs over WinRM (Windows Remote Management) and needs to be enabled on the target machine first.
Enabling remoting
On the target server, run this from an elevated PowerShell session:
Enable-PSRemoting -Force
This starts the WinRM service, sets it to start automatically, creates a listener to accept connections, and adds the necessary Windows Defender Firewall exception. On many current Windows Server installations WinRM is already running by default, in which case this simply confirms the configuration. If your servers are in an Active Directory domain, this is generally all you need, since domain authentication handles the trust relationship automatically.
If you’re connecting between machines in a workgroup rather than a domain, you’ll also need to add the target to the client’s list of trusted hosts, since there’s no domain trust to fall back on:
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "192.168.1.50" -Force
Running commands remotely
Invoke-Command runs a script block on one or more remote computers and returns the results to your session:
Invoke-Command -ComputerName SRV01 -ScriptBlock { Get-Service -Name W3SVC }
# Run against several servers at once
Invoke-Command -ComputerName SRV01,SRV02,SRV03 -ScriptBlock { Get-HotFix | Sort-Object InstalledOn -Descending | Select-Object -First 5 }
For a longer, interactive session on a single remote server, rather than one-off commands, use Enter-PSSession instead, which drops your prompt onto the remote machine until you type Exit-PSSession:
Enter-PSSession -ComputerName SRV01
Both cmdlets accept a -Credential parameter if you need to authenticate as a different account than the one you’re currently logged in as:
$cred = Get-Credential
Invoke-Command -ComputerName SRV01 -Credential $cred -ScriptBlock { Get-Service }
A note on security
WinRM listens on TCP 5985 (HTTP) and 5986 (HTTPS) by default. Only enable remoting on networks you trust, and prefer the HTTPS listener with a proper certificate if you’re remoting across anything other than an internal, controlled network. As with RDP, don’t expose WinRM directly to the internet. Locking this down properly is exactly the kind of thing worth including in a broader server security review.
Summary
PowerShell’s consistent Verb-Noun structure and object-based output make it worth learning properly rather than treating it as a slower version of the command prompt. Execution policy guards against running scripts by accident, and remoting with Enable-PSRemoting and Invoke-Command is what turns PowerShell from a per-server tool into something you can use to manage a whole estate of Windows Servers from one place. Every cmdlet covered elsewhere in this series, whether it’s managing updates, firewall rules, or local users, works the same way whether you run it locally or push it out to a dozen servers at once with remoting. If you’d rather not run this yourself at all, Managed Cloud Hosting covers this kind of day-to-day server administration for you.