JSI Tip 7324. How do I change the Administrator password on all my workstations, from my desktop, using freeware?

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
set NewPassword=%1
if exist password.log del /q password.log
call :blind>>nul 2>>&1
goto :EOF
for /f "Skip=1 Tokens=*" %%w in ('netdom query /domain:%USERDNSDOMAIN% WORKSTATION') do set cn=%%w&call :ws
goto :EOF
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
@echo %cn% password reset failed>>password.log
goto :EOF
@echo %cn% not available>>password.log

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.