For changing passwords for services across domain
First step:
Create the vbs script change.vbs
-----------------------------------------------------------------------
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("list.txt", ForReading)
Const ForReading = 1
Dim arrFileLines()
i = 0
Do Until objFile.AtEndOfStream
Redim Preserve arrFileLines(i)
arrFileLines(i) = objFile.ReadLine
i = i + 1
Loop
objFile.Close
For Each strLine in arrFileLines
MyArray = Split(strLine, "|", -1, 1)
strComputer = trim(MyArray(0))
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set SWBemlocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = SWBemlocator.ConnectServer(strComputer,"\root\CIMV2",UserName,Password)
Set colItems = objWMIService.ExecQuery("Select * from Win32_Service where DisplayName = '" & trim(MyArray(1)) & "'",,48)
For each objService in colItems
errServiceChange = objService.Change( , , , , , ,trim(MyArray(2)),trim(MyArray(3)))
'wscript.echo(errServiceChange)
objService.StopService()
wscript.sleep 20000
objService.StartService()
Next
Next
wscript.echo "Done"
-----------------------------------------------------------------------
If you don't want to restart service after changing password just remove next rows from script
objService.StopService()
wscript.sleep 20000
objService.StartService()
Second step:
Create text file list.txt consist of Server name, Service DisplayName, username in format domain\user, password divided by pipe (|)
-----------------------------------------------------------------------
Server1|SQLSERVERAGENT|DOMAIN.NET\user|password
Server1|MSSQLSERVER|DOMAIN.NET\user|password
Server2|Messenger|DOMAIN.NET\user|password
Server2|HTTP SSL|DOMAIN.NET\user|password
Server3|Computer Browser|DOMAIN.NET\user|password
-----------------------------------------------------------------------
share on:
facebook