Skip navigation

JSI Tip 8306. How do I change the Administrator's password on my member servers?


Using MemberServer.bat and PsExec freeware, I have scripted AdmPwdMbrSvr.bat to change the Administrator's password on my member servers.

The syntax for using AdmPwdMbrSvr.bat is:

AdmPwdMbrSvr NewPassword

Where NewPassword must conform to any local password policies that you have set.

AdmPwdMbrSvr.bat creates a password.log file in the current folder, that contains messages similar to:

<ComputerName> password changed
<ComputerName> password reset failed
<ComputerName> not available

AdmPwdMbrSvr.bat contains:

@echo off
if \{%1\}==\{\} @echo Syntax: AdmPwdMbrSvr 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 "Tokens=*" %%w in ('memberserver') do set cn=%%w&call :svr
goto :EOF
:svr
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



Hide comments

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.
Publish