Script to alter particaular services startup type

Hi All,

I have a VBScript that will change the service startup type from disabled to manual. The issue is that this will change all the services that are currently disabled to manual. I would like to some help on how to change only particaular services from disabled to manual and how to specify this within a script. For example RasAuto
Here is my current script

Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colServiceList = objWMIService.ExecQuery _
    ("Select * from Win32_Service where StartMode = 'Disabled'")
For Each objService in colServiceList
    errReturnCode = objService.Change( , , , , "Manual")  

Thanks for your help
Who is Participating?
you will have to check the service name first and then change its properties.

For Each objService in colServiceList
if(objService.Name == 'MyService')
     objService.Change( , , , , "Manual")

For more information, see below link:

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.