In tip 199, I performed this task by using Soon, and by including 3 lines of script for every workstation.
Using NetDOM from your support tools, and the PsExec freeware, I have scripted AdminPwd.bat.
To run AdminPwd.bat:
1. Log onto a Windows 2000, Windows XP, or newer workstation with a domain account that is a member of the Domain Admins group.
2. Open a CMD prompt and switch to a folder where you want the log file created.
3. Type AdminPwd The_New_Password and press Enter.
AdminPwd.bat contains:
@echo off if \{%1\}==\{\} @echo Syntax: AdminPwd NewPassword&goto :EOF setlocal set NewPassword=%1 if exist password.log del /q password.log call :blind>>nul 2>>&1 endlocal goto :EOF :blind for /f "Skip=1 Tokens=*" %%w in ('netdom query /domain:%USERDNSDOMAIN% WORKSTATION') do set cn=%%w&call :ws goto :EOF :ws if /i "%cn%" EQU "The command completed successfully." goto :EOF ping -n 1 %cn%>nul if %ERRORLEVEL% NEQ 0 goto wsdown psexec "\\%cn%" -s cmd.exe /c net user Administrator %NewPassword% if %ERRORLEVEL% NEQ 0 goto wserr @echo %cn% password changed>>password.log goto :EOF :wserr @echo %cn% password reset failed>>password.log goto :EOF :wsdown @echo %cn% not available>>password.log
0 comments
Hide comments