PowerShell & automation
PowerShell & automationbeginner12 min read·Updated Nov 13, 2026

25 PowerShell Commands Every Windows VPS Admin Needs

25 copy-paste PowerShell commands for daily Windows VPS admin: services, processes, files, networking, users, disk, remote management, and Windows Updates.

Genuine, fully-licensed Windows
Spin up a Windows Server: full admin, RDP-ready
Genuine Windows Server 2019, 2022, or 2025 with full administrator access. We handle the Microsoft licensing, billed monthly with nothing to buy upfront.

In short

These 25 PowerShell commands cover most daily admin work on a Raff Windows VPS: services, processes, files, networking, firewall rules, local users, disks, remote management and Windows Updates. Every command runs in Windows PowerShell 5.1, which is built into Windows Server 2019, 2022 and 2025, so nothing needs PowerShell 7. Copy, paste and adjust the names. To search the same commands by category, use the PowerShell command library.

How to follow along

Open PowerShell as Administrator on your Raff Windows VPS:

  1. RDP into the VPS (see Connect to a Raff Windows VPS via RDP)
  2. Right-click Start and choose Windows PowerShell (Admin), or Terminal (Admin) where Windows Terminal is installed. The keyboard shortcut is Win + X, then A.

Most commands below need admin rights, so run the whole session as Administrator.


Service management

1. List all services + status

Powershell
Get-Service | Select-Object Name, DisplayName, Status, StartType | Format-Table -AutoSize

Filter to a name pattern (e.g. all SQL services):

Powershell
Get-Service -Name 'MSSQL*'

Microsoft Learn: Get-Service

2. Restart a service

Powershell
Restart-Service -Name 'W3SVC' -Force

-Force skips the dependent-service prompt. For IIS specifically, iisreset is also a valid one-liner.

3. Change service startup type

Powershell
# Set to Automatic (starts on boot) Set-Service -Name 'MSSQLSERVER' -StartupType Automatic # Disable a service Set-Service -Name 'Spooler' -StartupType Disabled

Microsoft Learn: Set-Service


Process management

4. List running processes

Powershell
# All processes, sorted by RAM use Get-Process | Sort-Object WorkingSet64 -Descending | Select-Object -First 20 Name, Id, CPU, @{N='MB';E={[math]::Round($_.WorkingSet64/1MB,1)}}

Filter by name:

Powershell
Get-Process -Name 'sqlservr*'

5. Kill a process

Powershell
# By name Stop-Process -Name 'notepad' -Force # By PID (safer when multiple processes share a name) Stop-Process -Id 4452 -Force

-Force skips the user confirmation prompt. Use it sparingly: a forced stop skips the program's own cleanup.


File and folder operations

6. List directory contents recursively

Powershell
# Files only, recursive, with size in MB Get-ChildItem -Path 'C:\inetpub' -File -Recurse | Select-Object FullName, @{N='MB';E={[math]::Round($_.Length/1MB,2)}}, LastWriteTime | Sort-Object MB -Descending | Select-Object -First 20

Find files larger than 100 MB (great for "what's eating my disk?"):

Powershell
Get-ChildItem -Path 'C:\' -File -Recurse -ErrorAction SilentlyContinue | Where-Object Length -gt 100MB | Select-Object FullName, @{N='MB';E={[math]::Round($_.Length/1MB,1)}}

7. Copy with retry + logging (Robocopy wrapper)

Copy-Item is fine for one-off; for backups, use Robocopy via PowerShell:

Powershell
# Mirror a folder, retry 3x on errors, log to file robocopy 'C:\Source' 'D:\Backup' /MIR /R:3 /W:5 /LOG:'C:\Logs\backup.log' /NP

Robocopy isn't a PowerShell cmdlet but it's the standard tool for serious file ops on Windows. PowerShell scripts wrap it for backup automation.

8. Calculate folder size

Powershell
(Get-ChildItem -Path 'C:\inetpub' -Recurse -ErrorAction SilentlyContinue | Measure-Object -Property Length -Sum).Sum / 1GB

Returns size in GB. Wrap in [math]::Round(..., 2) for clean output.


System information

9. Get OS + hardware overview

Powershell
Get-ComputerInfo | Select-Object CsName, OsName, OsVersion, OsBuildNumber, OsHardwareAbstractionLayer, CsTotalPhysicalMemory, CsNumberOfLogicalProcessors

Microsoft Learn: Get-ComputerInfo

10. List installed Windows updates

Powershell
Get-HotFix | Sort-Object InstalledOn -Descending | Select-Object -First 20 HotFixID, Description, InstalledOn, InstalledBy

11. Read the Event Log

Powershell
# Last 50 errors from the System log Get-EventLog -LogName System -EntryType Error -Newest 50 | Format-Table TimeGenerated, Source, EventID, Message -AutoSize -Wrap

On current Windows Server versions, prefer Get-WinEvent, which also works in PowerShell 7, where Get-EventLog was removed:

Powershell
# Last 50 errors using the new event log API Get-WinEvent -FilterHashtable @{LogName='System'; Level=2} -MaxEvents 50 | Format-Table TimeCreated, Id, ProviderName, Message -AutoSize -Wrap

Networking

12. List IP addresses

Powershell
Get-NetIPAddress | Where-Object AddressFamily -eq 'IPv4' | Select-Object InterfaceAlias, IPAddress, PrefixLength, AddressState

13. Test if a remote port is open

Powershell
Test-NetConnection -ComputerName 'google.com' -Port 443

The PowerShell equivalent of nc -zv: it resolves the name and confirms the TCP port answers. Microsoft Learn: Test-NetConnection

14. List Windows Firewall rules

Powershell
# All inbound allow rules Get-NetFirewallRule -Direction Inbound -Action Allow -Enabled True | Sort-Object DisplayName | Select-Object DisplayName, Profile, @{N='Port';E={(Get-NetFirewallPortFilter -AssociatedNetFirewallRule $_).LocalPort}}

15. Add a firewall rule

Powershell
# Allow inbound TCP 8080 New-NetFirewallRule -DisplayName 'Custom App TCP 8080' ` -Direction Inbound -Protocol TCP -LocalPort 8080 ` -Action Allow -Profile Any

Restrict by source IP for tighter security:

Powershell
New-NetFirewallRule -DisplayName 'SQL from Office' ` -Direction Inbound -Protocol TCP -LocalPort 1433 ` -RemoteAddress '203.0.113.10/32' ` -Action Allow

Microsoft Learn: New-NetFirewallRule


User and group management

16. List local users

Powershell
Get-LocalUser | Format-Table Name, Enabled, LastLogon, Description -AutoSize

17. Create a local user

Powershell
$password = Read-Host 'Password' -AsSecureString New-LocalUser -Name 'jane.doe' -Password $password -FullName 'Jane Doe' -Description 'Accountant'

18. Add a user to a group

Powershell
# Grant RDP access Add-LocalGroupMember -Group 'Remote Desktop Users' -Member 'jane.doe' # Grant local admin (use sparingly!) Add-LocalGroupMember -Group 'Administrators' -Member 'jane.doe'

Microsoft Learn: Add-LocalGroupMember


Disk and storage

19. Show disk and volume usage

Powershell
# Volumes with free space Get-Volume | Where-Object DriveLetter | Select-Object DriveLetter, FileSystemLabel, @{N='SizeGB';E={[math]::Round($_.Size/1GB,1)}}, @{N='FreeGB';E={[math]::Round($_.SizeRemaining/1GB,1)}}, @{N='UsedPct';E={[math]::Round((1-$_.SizeRemaining/$_.Size)*100,1)}}

20. Show physical disks

Powershell
Get-PhysicalDisk | Format-Table FriendlyName, MediaType, Size, HealthStatus

Shows each disk Windows sees, with its size and health status.


Remote management

21. Enable PowerShell remoting (server side)

Powershell
# On the server you want to manage remotely Enable-PSRemoting -Force

Microsoft Learn: Enable-PSRemoting

22. Run a command on a remote server

Powershell
# Run on a single remote machine Invoke-Command -ComputerName 'SERVER02' -ScriptBlock { Get-Service W3SVC } # Run on a fleet Invoke-Command -ComputerName 'SRV01','SRV02','SRV03' -ScriptBlock { Get-CimInstance Win32_OperatingSystem | Select-Object PSComputerName, Caption, BuildNumber }

23. Open an interactive remote PowerShell session

Powershell
Enter-PSSession -ComputerName 'SERVER02' -Credential (Get-Credential) # Now you're 'inside' SERVER02: every command runs there. Type 'exit' to leave.

Performance

24. Live performance counters

Powershell
# CPU + memory snapshot every 2 seconds, 10 samples Get-Counter -Counter '\Processor(_Total)\% Processor Time', '\Memory\Available MBytes' ` -SampleInterval 2 -MaxSamples 10

Useful counters for Windows Server admin:

CounterWhat it shows
\Processor(_Total)\% Processor TimeOverall CPU %
\Memory\Available MBytesFree RAM
\PhysicalDisk(_Total)\Avg. Disk Queue LengthDisk queue (stays high when the disk is the bottleneck)
\Network Interface(*)\Bytes Total/secNetwork throughput per NIC
\Process(*)\Working SetRAM per process

25. Install + run Windows Updates from PowerShell

The built-in Windows Update UI works, but for headless / Server Core / scripted patching:

Powershell
# One-time: install the PSWindowsUpdate module from PowerShell Gallery Install-Module -Name PSWindowsUpdate -Force -Scope AllUsers # Check what's available Get-WindowsUpdate # Install everything (will reboot if needed) Get-WindowsUpdate -Install -AcceptAll -AutoReboot # Install only security updates Get-WindowsUpdate -Install -AcceptAll -Category 'Security Updates' -AutoReboot

PSWindowsUpdate is community-maintained but widely used. Source: PSWindowsUpdate on the PowerShell Gallery.


Bonus: discoverability

When you forget a command name, PowerShell's discovery tools help:

Powershell
# Find cmdlets by keyword (no need to know exact name) Get-Command *firewall* # See full help for any cmdlet (requires Update-Help once) Get-Help Get-Service -Full # See examples only Get-Help Get-Service -Examples # Update help files (do once after install) Update-Help -Force -ErrorAction SilentlyContinue

What's next

Sources

Was this article helpful?

Frequently asked questions

Do these commands need PowerShell 7 installed?
No. Everything in the list runs on Windows PowerShell 5.1, which ships built-in with Windows Server 2019, 2022 and 2025. PowerShell 7 works too, but nothing here requires it.
How do I list only running services?
Use Get-Service piped through a status filter: Get-Service | Where-Object Status -eq Running. Add Format-Table for a compact view, or filter by name pattern like Get-Service MSSQL* for one application's services.
How can I check CPU and RAM usage from PowerShell?
Get-Counter with the Processor and Available MBytes counters gives live samples, and Get-Process sorted by WorkingSet64 shows which processes hold the memory. Together they answer "why is the server slow?" in under a minute.
Can I run these commands against a remote server?
Yes. Enable PowerShell remoting on the target with Enable-PSRemoting, then use Invoke-Command for one-off commands or Enter-PSSession for an interactive session, including against a whole list of servers at once.

Published November 13, 2026 · Updated November 13, 2026

Back to hub
Ready when you are

Your Windows Server, live in ~55 seconds

Genuine, fully-licensed Windows with full admin and RDP. We handle the Microsoft licensing, billed monthly with nothing upfront. On NVMe SSD, backed by a 14-day money-back guarantee.

Related articles