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
LVL 1
MattywertsAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sarika30Commented:
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:
http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/services/

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.