| |
kmarty009
Posts: 64
Score: 0
Joined: 5/21/2004
From: USA
Status: offline
|
I have written this batch file script to change admin passwords. It works great except that it is not writing to the log file on failures. I guess I need is someone to help me make sure that failures are written to another text file called failure.txt. I have tried using errorlevel but it never writes the failures. can anyone help me out? Thanks. @echo off :: Password Script for Changing Windows Servers :: Created By Kirk Marty and Eric Welshons :: 7/31/2007 :: Before Running this script you must change the 4 Variables below :: Copy this script to your hard drive and run in a DOS Window SET _SERVERLIST=C:\Jobs\servers.txt SET _USERNAME=domain\username SET _PASSWORD=password SET _ADMNAME=administrator SET _ADMPASSWD=password ::Checking for the server file if not exist "%_ServerList%" ( echo serverlist "%_SERVERLIST%" not found. Create it and try again. exit /b 1 ) :: let us do our work in a for loop for /F %%i in ('type "%_SERVERLIST%"') do ( echo Machine %%i pspasswd \\%%i -u %_USERNAME% -p %_PASSWORD% %_ADMNAME% %_ADMPASSWD% >>results.txt )
_____________________________
KirkM.
|
|