VB Script needed to alter local server services

I have a couple of servers, that whenever they reboot critical services fail to start.  I have to log into the server and change the password on the local service accounts.  I then am able to start the services just fine.

I really need a VB Script that can automate this for me.  I need it to be able to assign user name and password for the service locally, then I need it to start the service.

I spent 4 hours on the phone with Symantec and they were no help.  I also have a SQL server that is doing the same thing on a remote network in a different domain and context altogether.

Any help would be great!
bbanis2kAsked:
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.

BMPTSCommented:
instead of using VB just use a batch file and the SC command

SC config to set password
(sc <server> config [service name] <option1> <option2>)

sc start and stop
(sc <server> start [service name] <arg1> <arg2>)

go to a command prompt and type SC /? or SC Config /?.

If you are dead set on VBS then just start the command prompt and stream the commands into the command window.

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
bbanis2kAuthor Commented:
I will try that...
Iced-evilCommented:
Here a a VBScript that does what you need
strComputer = "computername"
strService = ".\servicename"
strPassword = "password"
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colServiceList = objWMIService.ExecQuery _
    ("Select * from Win32_Service")
For Each objservice in colServiceList
    If objService.Startname = strService Then
        errReturn = objService.Change( , , , , , , ,strPassword)
        errReturn = objService.StartService()
    End If 
Next

Open in new window

bbanis2kAuthor Commented:
This worked pefectly fine!  Thank you
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.