0

Recently I tried to enumerate the Windows Services on the VM where my Azure web role instance runs using ServiceController.GetServices() - there's a lot of them including Telephony and CloudDrive which I don't need and so having them started is a waste of resources.

Is it possible to have them not started?

sharptooth
  • 167,383
  • 100
  • 513
  • 979

1 Answers1

0

Yes, but you'll need a startup task to do this. Here is what you'll do to stop and disable the Telephony service:

sc.exe stop TapiSrv
sc.exe config TapiSrv start= disabled

As you can see I'm not using the display name (Telephony) but I'm using the service name (TapiSrv). If you want to get a list of service names for your system you can simply execute this command (in Azure you can do this via RDP):

sc.exe query

Executing this command will also give you the state of the service (running, ...).

Note: When calling sc.exe config you need to put a space after the equals sign.

Note: Stopping services can take some time, so I suggest you use a background task to stop/disable the services, in order to keep the startup time of your instance to a minimum.

Sandrino Di Mattia
  • 24,739
  • 2
  • 60
  • 65
  • I don't want to stop them, I want them to not be started in the first place, otherwise they waste the time to get started anyway. – sharptooth Aug 02 '12 at 10:14
  • Startup tasks are the earliest point in the deployment where you can do something. If you want to disable the services before that you'll need to come up with a custom VM (that already disables the services) and use the VM Role (but this is still in beta). Now if you disable the services once, this will stay like this for each reboot (not if you add new instances or deploy to another slot). Do you really thing starting these basic Windows services once would have such an impact on your resources? – Sandrino Di Mattia Aug 02 '12 at 10:54
  • I'm not sure, I wanted to try that, but looks like it's impossible without VM roles. – sharptooth Aug 02 '12 at 11:43