Start or stop Windows service from command line (CMD)

by admin on August 15, 2010

We normally use Services.msc to start or stop or disable or enable any service. We can do the same from windows command line also using net and sc utilities. Below are commands for controlling the operation of a service.

Command to stop a service:

net stop servicename

To start a service:

net start servicename

You need to have administrator privileges to run net start/stop commands. If you are just a normal user on the computer, you would get an error like below.

C:\>net start webclient
System error 5 has occurred.
Access is denied.
C:\>

To disable a service:

sc config servicename start= disabled

To enable a service:

sc config servicename start= demand

To make a service start automatically with system boot:

sc config servicename start= auto

Note: Space is mandatory after ‘=’ in the above sc commands.

This SC command works on a Windows 7 machine and also on the down-level editions of Windows i.e Windows XP/2003 and Windows Vista. Again, if you do not have administrator previliges you would get the below error.

C:\>sc config webclient start= auto
[SC] OpenService FAILED 5:
Access is denied.

Note that the service name is not the display name of a service. Each service is given a unique identification name which can be used with net or sc commands. For example, Remote procedure call (RPC) is the display name of the service. But the service name we need to use in the above commands is RpcSs.
So to start Remote procedure call service the command is:

net start RpcSsTo stop Remote procedure call service
net stop RpcSs

These service names are listed below for each service. The first column shows the display name of a service and the second column shows the service name that should be used in net start or net stop or sc config commands.

 

Display Name of the serviceServiceName which should be used with ‘net’ and ‘sc config’ commands.
AlerterAlerter
Application Layer Gateway ServiceALG
Application ManagementAppMgmt
ASP.NET State Serviceaspnet_state
Windows AudioAudioSrv
Background Intelligent Transfer ServiceBITS
Computer BrowserBrowser
Bluetooth Support ServiceBthServ
Bluetooth Servicebtwdins
SMS Agent HostCcmExec
Indexing ServiceCiSvc
ClipBookClipSrv
.NET Runtime Optimization Service v2.0.50727_X86clr_optimization_v2.0.50727_32
COM+ System ApplicationCOMSysApp
Cryptographic ServicesCryptSvc
Cisco Systems, Inc. VPN ServiceCVPND
DCOM Server Process LauncherDcomLaunch
DHCP ClientDhcp
Logical Disk Manager Administrative Servicedmadmin
Logical Disk Managerdmserver
DNS ClientDnscache
Lenovo Doze Mode ServiceDozeSvc
Error Reporting ServiceERSvc
Event LogEventlog
COM+ Event SystemEventSystem
Intel(R) PROSet/Wireless Event LogEvtEng
Fast User Switching CompatibilityFastUserSwitchingCompatibility
Windows Presentation Foundation Font Cache 3.0.0.0FontCache3.0.0.0
Group Policy MonitorGPMON_SRV
Help and Supporthelpsvc
HID Input ServiceHidServ
HTTP SSLHTTPFilter
ThinkPad PM ServiceIBMPMSVC
Windows CardSpaceidsvc
IMAPI CD-Burning COM ServiceImapiService
iPassConnectEngineiPassConnectEngine
iPassPeriodicUpdateAppiPassPeriodicUpdateApp
iPassPeriodicUpdateServiceiPassPeriodicUpdateService
IviRegMgrIviRegMgr
Serverlanmanserver
Workstationlanmanworkstation
Lenovo Camera MuteLENOVO.CAMMUTE
Lenovo Microphone MuteLenovo.micmute
TCP/IP NetBIOS HelperLmHosts
Intel(R) Management and Security Application Local Management ServiceLMS
McAfee Framework ServiceMcAfeeFramework
McAfee McShieldMcShield
McAfee Task ManagerMcTaskManager
Machine Debug ManagerMDM
MessengerMessenger
NetMeeting Remote Desktop Sharingmnmsrvc
Distributed Transaction CoordinatorMSDTC
Windows InstallerMSIServer
Net Driver HPZ12Net Driver HPZ12
Network DDENetDDE
Network DDE DSDMNetDDEdsdm
Net LogonNetlogon
Network ConnectionsNetman
Net.Tcp Port Sharing ServiceNetTcpPortSharing
Network Location Awareness (NLA)Nla
NT LM Security Support ProviderNtLmSsp
Removable StorageNtmsSvc
Microsoft Office Diagnostics Serviceodserv
Office Source Engineose
Plug and PlayPlugPlay
Pml Driver HPZ12Pml Driver HPZ12
IPSEC ServicesPolicyAgent
Power Manager DBC ServicePower Manager DBC Service
Protected StorageProtectedStorage
Remote Access Auto Connection ManagerRasAuto
Remote Access Connection ManagerRasMan
Remote Desktop Help Session ManagerRDSessMgr
Intel(R) PROSet/Wireless Registry ServiceRegSrvc
Routing and Remote AccessRemoteAccess
Remote RegistryRemoteRegistry
Remote Procedure Call (RPC) LocatorRpcLocator
Remote Procedure Call (RPC)RpcSs
QoS RSVPRSVP
Intel(R) PROSet/Wireless WiFi ServiceS24EventMonitor
Security Accounts ManagerSamSs
Smart CardSCardSvr
Task SchedulerSchedule
Secondary Logonseclogon
System Event NotificationSENS
Windows Firewall/Internet Connection Sharing (ICS)SharedAccess
Shell Hardware DetectionShellHWDetection
Print SpoolerSpooler
System Restore Servicesrservice
SSDP Discovery ServiceSSDPSRV
Windows Image Acquisition (WIA)stisvc
System UpdateSUService
MS Software Shadow Copy ProviderSwPrv
Performance Logs and AlertsSysmonLog
TelephonyTapiSrv
Terminal ServicesTermService
ThemesThemes
ThinkVantage Registry Monitor ServiceThinkVantage Registry Monitor Service
TelnetTlntSvr
On Screen DisplayTPHKSVC
Distributed Link Tracking ClientTrkWks
TVT SchedulerTVT Scheduler
Windows User Mode Driver FrameworkUMWdf
Intel(R) Management & Security Application User Notification ServiceUNS
Universal Plug and Play Device Hostupnphost
Uninterruptible Power SupplyUPS
Volume Shadow CopyVSS
Windows TimeW32Time
WebClientWebClient
Windows Management Instrumentationwinmgmt
Portable Media Serial Number ServiceWmdmPmSN
Windows Management Instrumentation Driver ExtensionsWmi
WMI Performance AdapterWmiApSrv
Security Centerwscsvc
Automatic Updateswuauserv
SMS Remote Control AgentWuser32
Wireless Zero ConfigurationWZCSVC
Network Provisioning Servicexmlprov

 

{ 9 comments… read them below or add one }

Anonymous September 8, 2010 at 3:12 pm

I get this error when using this command, anyone have any idea why "
[SC] OpenService FAILED 1060:

The specified service does not exist as an installed service."

Reply

Techblogger September 8, 2010 at 3:28 pm

Which OS you are trying this on? Verify that you have given the service name correctly. May be the service you are trying to disable is not installed on the OS edition you have.

Reply

Techblogger September 8, 2010 at 3:29 pm

you can find the correct service name by doing the following:

Start > Run > services.msc

right click on the service you want to control and choose Properties

the service name will be listed at the very top of the window as "Service name" and NOT "Display Name".

Reply

Anonymous September 8, 2010 at 3:30 pm

We can see which services are being run in the background by typing services.msc in the run window. Also msconfig utility is one of the programs which lets us see which all programs are being started at the startup.

Reply

Anonymous July 10, 2011 at 5:21 pm

Yes, I have the same issue (Win 7 Pro). srservice does not start and when trying, it says "The service name is invalid" and does not show up in the Services list using services.msc. I have had a HDD failure and lost some data, clearly.

How can I re-install a lost service?

Reply

Amit August 24, 2012 at 1:39 pm

I want to start or stop the windows service using a batch script but I also want to enable some kind of log to capture any failure while start/stop. Kindly help.

Reply

admin August 24, 2012 at 6:10 pm

Any issues with a command like below?

net start servicename > logfilename

ben July 16, 2014 at 9:43 pm

to disable windows error reporting on windows 7 :

sc config WerSvc start= disabled

Reply

BigJonMX July 29, 2014 at 8:23 am

I keep getting Access Denied, even though I am the administrator and there are no other users on this win7 machine.
I cant find out why sc stop just wont work!

Reply

Leave a Comment

HTML tags are not allowed.

Previous post:

Next post: