brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: Get-Service -RequiredServices shows what a Windows service needs to start

Windows
~/tips/tip-windows-get-service-required

Get-Service WinRM -RequiredServices

Shows the services a Windows service depends on, and which services depend on it.

A Windows service that refuses to start is often waiting for another service that is disabled. PowerShell can show you the chain.

Get-Service WinRM -RequiredServices

That lists the services WinRM needs. The other direction is -DependentServices, which shows what depends on it, so what else stops when you stop this one:

Get-Service LanmanServer -DependentServices

-Name takes wildcards, which helps when you only half remember the name:

Get-Service "wmi*"
Get-Service | Where-Object {$_.Status -eq "Running"}

The second line is the docs’ own example for listing only running services. Because the output is objects, you can export the list before you change anything.

The objects also carry a Status, so piping the result into Format-Table Name, Status gives you a quick overview of the whole chain in one table.

Where I’d use it: before disabling a service a tuning guide told me to turn off. If -DependentServices returns a list, something else needs it.

Caveats. It is a Windows-only cmdlet. Wildcards only return Windows services, not device drivers. What you see can depend on your permissions, so run PowerShell as administrator when a service seems to be missing. And PowerShell 6 removed the old -ComputerName parameter; for another machine, the docs point to Invoke-Command.

Further reading: Get-Service on Microsoft Learn

More Windows tips Win+Ctrl+C Win+Shift+Left arrow Win+Ctrl+Left arrow Alt+PrtScn Left Alt + Left Shift + Print Screen All Windows tips (33) All topics

Link