NET START <SERVICE> - how/where to get the service name?
I get that from the registry: HKLM\System\CurrentControlSet\Services. Each subkey is the name of a service or driver. Just search for the one you are looking for.
Use sc
rather than net
, since it boasts a lot more features. It was first introduced (IIRC) in Windows XP:
sc GetKeyName "printer spooler"
should print something like:
[SC] GetServiceKeyName SUCCESS Name = Spooler
And you can then use that name in other commands, like sc start
and sc stop
.
- Start → Run
- Then type:
services.msc
. - Double click on the service that you're interested in.
You should see:
For systems that have access to PowerShell. A better way to do this is with the Cmdlet "Get-Service". You can invoke it by typing:
Get-Service -DisplayName "Print Spooler"
Which will return:
Status Name DisplayName
------ ---- -----------
Running Spooler Print Spooler
Where you get the name of the service under Name. The DisplayName parameter can take wild cards if you like. If you want to get the Display name you can write:
Get-Service -Name spooler
Which would return the same table as above. You can also write:
(Get-Service -DisplayName "Print Spooler").Name
To get just the name (avoid a table).
This is really only necessary to do to check if a service is running. PowerShell have the Cmdlet Start-Service and Stop-Service which takes the parameter -Name and -DisplayName so you could write:
Start-Service -DisplayName "Print Spooler"
Stop-Service -DisplayName "Print Spooler"
To start and stop the service.
In this case I've used PowerShell 2.0 so I guess it will work on any Windows above and including XP.