If you have services that run in a DomainName/UserName context on multiple machines in your domain, resetting the DomainName/UserName password can be quite a chore.
To totally automate this process using NETSVC and SC from Supplement 4 of the Resource kit, add the following batch files to your path:
SetSvcPw.bat
@echo off
@echo SetSvcPw %1 %2 %3
if exist %1 goto OK
:bad
@echo Syntax: Error: SetSvcPw "<Drive:>\<Path>\ComputerName.txt" DomainName\UserName password
goto end
:OK
if .%2.
.. goto bad
if .%3.
.. goto bad
for /f %%i in ('type %1') do call :setsvcpws %%i %2 %3
goto end
:setsvcpws
if exist %temp%\NETSVC.LOG del /f /q %temp%\NETSVC.LOG
for /f "Tokens=1,2* Delims=," %%a in ('netsvc \\%1 /list') do echo %%b >> %TEMP%\netsvc.log
for /f %%s in (%TEMP%\netsvc.log) do call SetSvcPwT %%s %1 %2 %3
if exist %temp%\NETSVC.LOG del /f /q %temp%\NETSVC.LOG
:end
SetSvcPwT.bat
@echo off
if "%1"
"ECHO" goto end
for /f "Tokens=1,2,3* Delims= " %%i in ('sc \\%2 qc %1') do call :user %%k %1 %2 %3 %4
goto end
:user
if /i NOT "%1"
"%4" goto end
echo \\%3 %2 %4 %5
sc \\%3 stop %2
sleep 4
sc \\%3 config %2 obj= %4 password= %5
sc \\%3 qc %2
sc \\%3 start %2
:end
To run the job and log the results, type:
SetSvcPw "<Drive:>\<Path>\ComputerName.txt" DomainName\UserName password >> "<Drive:>\<Folder>\SetSvcPw.log" 2>&1
Where "<Drive:>\<Path>\ComputerName.txt" contains a list of computer names in your domain (see tip 677).
The Format of "<Drive:>\<Path>\ComputerName.txt" is:
ComputerName1
ComputerName2
. . . . . . . . . . . .
ComputerNamen