pspasswd in batch file issue

Author Message
kmarty009

  • Total Posts : 65
  • Scores: 0
  • Reward points : 0
  • Joined: 5/21/2004
  • Location: USA
  • Status: offline
pspasswd in batch file issue Tuesday, July 31, 2007 9:06 AM (permalink)
0
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.
 
#1

    Online Bookmarks Sharing: Share/Bookmark

    Jump to:

    Current active users

    There are 0 members and 1 guests.

    Icon Legend and Permission

    • New Messages
    • No New Messages
    • Hot Topic w/ New Messages
    • Hot Topic w/o New Messages
    • Locked w/ New Messages
    • Locked w/o New Messages
    • Read Message
    • Post New Thread
    • Reply to message
    • Post New Poll
    • Submit Vote
    • Post reward post
    • Delete my own posts
    • Delete my own threads
    • Rate post

    2000-2012 ASPPlayground.NET Forum Version 3.9