Search GimmeJob

Type at least 2 characters. Enter also searches by meaning.
QA interview question
InfrastructureMiddleOccasionalTroubleshooting

How do you inspect and control Windows services from the command line?

Answer

Command Prompt can use `sc query <service>` to inspect service state and `sc start` or `sc stop` to control it. PowerShell provides `Get-Service`, `Start-Service`, `Stop-Service` and `Restart-Service`. A service reported as Running is only one signal; verify the process, listener, dependency and application health before concluding the service works.

Strong answer includes

  • knows sc query and PowerShell service cmdlets
  • service state is not equivalent to endpoint health
  • checks dependencies and logs before unnecessary restarts

Practical example

A Windows API service shows Running, but tests get connection refused. Check the service, then verify whether its process is actually listening on the expected port and inspect Event Log or application logs before restarting it.

#windows#services#powershell#troubleshooting

Sources

Windows commands referenceMicrosoft · Command Prompt utilities including ipconfig, netstat, tasklist, taskkill, sc, findstr, ping, tracert and nslookupPowerShell documentationMicrosoft · PowerShell cmdlets, object pipeline, processes, services, networking, event logs and environment handlingPowerShell Interview QuestionsWeCP · Recurrence signal for PowerShell fundamentals, cmdlets, services, processes, pipelines and troubleshooting questions