'========================================================================== ' ' VBScript Source File -- Created with SAPIEN Technologies PrimalScript 2009 ' ' NAME: ' ' AUTHOR: James Vierra , Designed Systems & Services ' DATE : 9/21/2008 ' ' COMMENT: Resets the service account and/or password ' '========================================================================== Function WMIChangeServiceAccount(sComputer,serviceName, account, password ) Set wmi = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & sComputer & "\root\cimv2") Set colServices = wmi.ExecQuery("Select * From Win32_Service Where Name = '" & serviceName & "'") For Each oService in colServices result = oService.Change(Null ,Null ,Null ,Null ,Null ,Null ,account , password) If result <> 0 Then Select Case result Case 0 : msg = "Success" Case 1 : msg = "Not Supported" Case 2 : msg = "Access Denied" Case 3 : msg = "Dependent Services Running" Case 4 : msg = "Invalid Service Control" Case 5 : msg = "Service Cannot Accept Control" Case 6 : msg = "Service Not Active" Case 7 : msg = "Service Request Timeout" Case 8 : msg = "Unknown Failure" Case 9 : msg = "Path Not Found" Case 10 : msg = "Service Already Running" Case 11 : msg = "Service Database Locked" Case 12 : msg = "Service Dependency Deleted" Case 13 : msg = "Service Dependency Failure" Case 14 : msg = "Service Disabled" Case 15 : msg = "Service Logon Failure" Case 16 : msg = "Service Marked For Deletion" Case 17 : msg = "Service No Thread" Case 18 : msg = "Status Circular Dependency" Case 19 : msg = "Status Duplicate Name" Case 20 : msg = "Status Invalid Name" Case 21 : msg = "Status Invalid Parameter" Case 22 : msg = "Status Invalid Service Account" Case 23 : msg = "Status Service Exists" Case 24 : msg = "Service Already Paused" Case Else : msg = "Not defined" End Select Wscript.StdErr.WriteLine "WMIChangeServiceAccount failed:" & msg End If Next End Function WMIChangeServiceAccount ".", "Browser", "domain\account", "newpassword"