Change service password on many machines at once
Top  Previous  Next


[Settings_Begin]
BatchSettings.Delimiter=TAB
BatchSettings.MarkerCol=4
Set Service=Schedule
[Settings_End]

[Machines_Begin]
\\EDU12
\\EDU14
\\EDU15
[Machines_End]

[Batch_Begin]
Data.Loop   
Account.Edit.Password %col1%, %col2%   
Service.SetLogOn %Service%,.\%col1%,%col2%
Service.Control %Service%, Stop   
Service.Control %Service%, Start   
Data.Endloop   
[Batch_End]

[Data_Begin]
account   password      
[Data_End]

What the script does

·Change local service account password.  
·Change service password (account will also be changed if different than the existing)  
·Restart service  

This script works on both servers and workstations.

What to modify in the example

·   [Settings]: replace "Schedule" with your service name
·   [Machines]: insert your own machine names
·   [Data]: replace "account" with your service account
·   [Data]: replace "password" with your new password

Notice the "." instead of a ServiceAccount Domain on the "Service.SetLogOn" row - it means that the account belongs to the local system.

Notice: the above example changes password / user for the Schedule service, but the account should NOT be changed from "localsystem" unless the old Schedule Service, "ATSVC.EXE" is used. Since jobs can be run under different accounts with MSTASK.EXE, there is no need to change the schedule service account. [The display name and executable changed in Windows 2000 (and in NT4 after installing IE5) to "Task Scheduler" and "MSTASK.EXE" (see running processes), but the service name is still "schedule". The differences are these: ATSVC.EXE - greater resolution - every second Vs every minute (some people have replaced MSTASK.EXE with the older ATSVC.EXE because of this). MSTASK.EXE - possible to run jobs under different accounts (id/pw accessible from control panel / scheduled tasks, unfortunately not from "at.exe"), possible to run jobs every X hours or minutes (not just days), possible to terminate jobs that runs too long.]