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:
- RDP into the VPS (see Connect to a Raff Windows VPS via RDP)
- Right-click Start and choose Windows PowerShell (Admin), or Terminal (Admin) where Windows Terminal is installed. The keyboard shortcut is
Win + X, thenA.
Most commands below need admin rights, so run the whole session as Administrator.
Service management
1. List all services + status
Get-Service | Select-Object Name, DisplayName, Status, StartType | Format-Table -AutoSize
Filter to a name pattern (e.g. all SQL services):
Get-Service -Name 'MSSQL*'
Microsoft Learn: Get-Service
2. Restart a service
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
# 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
# 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:
Get-Process -Name 'sqlservr*'
5. Kill a process
# 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
# 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?"):
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:
# 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
(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.