Managing services. Starting, stopping and changing startup type need an elevated prompt.
Find a service
Get-Service -Name *spool*
Get-Service -DisplayName "*print*"
Only running (or only stopped) services
Get-Service | Where-Object Status -eq 'Running'
Get-Service | Where-Object Status -eq 'Stopped'
Start / stop / restart (admin)
Start-Service -Name Spooler
Stop-Service -Name Spooler
Restart-Service -Name Spooler
Set the startup type (admin)
Set-Service -Name Spooler -StartupType Automatic # or Manual / Disabled
Services set to auto-start but not running
Get-Service | Where-Object { $_.StartType -eq 'Automatic' -and $_.Status -ne 'Running' }
Manage a service on a remote machine
Get-Service -ComputerName SERVER01 -Name W32Time
Note: Get-Service shows StartType natively in PowerShell 7+ / recent 5.1; on older builds
use Get-CimInstance Win32_Service | Select Name, State, StartMode. To stop a service that has
dependents, add -Force to Stop-Service.