WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Password Tips

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Sample Script from User to Change Network Password

Keywords:    chngpass.bat paschgnw.wbt passdll.wbt passshut.wbt password.txt

Question:

I am trying to write a script that will enable a user to change a LAN password (NT domain) from a win95 PC. However, I can only find the change password function in the wwwnt34I.dll file. When I try to call that from a Win95 PC, it gives me an error that I am running an NT DLL on 95.

The goal is to eliminate navigating through the control panel every time a user wants to change a password. Am I wrong in thinking this should be a relatively easy task (considering how it's done for the Novell DLL)? If it is this easy, what am I missing?

Answer:

My Integrated Password change program(s) allows changing ALL your passwords at the same time, including Win95, Screen saver NT and or NetWare. I hope that this information will prove useful. We are currently using this code in production and have been for almost a year with no major changes.

It is fairly involved due to our circumstances, but is also modular, well commented code that should be easy to remove or modify to your specifics.

Our situation is that we Primarily login to Novell NW 3.12 servers, (soon to be NW 4) but have to also access a remote NT domain. Unfortunately, we DON'T control the remote domain, so that duplicated passwords were starting to be a real pain, as they would work fine for one system but fail on the other, which throws them out of sync. I would recommend that you should have unique passwords set on ONLY the primary login system, this way they are checked but will NOT be refused by the other servers when doing the total password change.

My solution was to run a separate batch file to do a net password on the PDC (you can ONLY change your password on a PDC, if you don't have a domain controller on your subnet) and then respond to the error codes coming back. This is the hardest and most crucial component to get working. If these are OK, I then spawn the Windows password change program, after modifying the registry to only change the things I want. (the screen saver can be a MAJOR pain if it is out of sync, so I disable it) The Windows program is run from a separate called program, and then I do a SendKeys to it to respond to the appropriate prompts. This allows using a DLLCall that I received from another user. The BEST part of this is that you can have policies restricting the Windows password change program from running, but MY program still works fine. This allows keeping control of what is run and prevents losing sync by not changing ALL the appropriate passwords.

To make things less interesting (i.e., easier to support), I have a Large box, filling the whole screen while the background processing is going on; this should keep the users hands out of the process.

Then, when all is done, I create a 5 minute countdown (with warnings) that reboots the workstation to allow time for the changed account information to replicate from the PDC to the BDC at our site. Without this reboot, we have found that users have been refused access to some shares, as the passwords are out of sync between the PDC and the BDC (where the shares actually reside). If you are interested in the code for this, drop me a line and I will send you what I have.

There are a couple of other things in this program, for instance I look for a Flag file called FORCPASS.FLG which creates a Forced password change. This was done for our conversions to create standardized passwords for our Admins to login to the machines.

I also create/update a Flag file called PASSLEVH.BAT which is the date of the last forced password change. To avoid problems with passwords expiring, we change the date in our network file (called PASSLEVN.BAT) and this, along with a large batch file that ALL our users run while logging in, will bring up the PASSCHNG program to "force" the users to change their passwords. Then I log the date and time of the change in another file called PASSCHNG.LST. This file will be used to exclude users from being forced to change their passwords if they have already changed them within an Administrator definable period.

I would appreciate getting your comments on my program, both positive and negative are welcomed. Thanks.

Mike (mmurphy@shl.com)


  1. Code follows, for the PASSCHNG.BAT file, I actually call the PIF file which I place in the same directory as the BATCH file (on a network drive) The important things to have in it are: Don't suspend in background, Close window when done and run minimized. I did not bother including the PIF file for that reason.

  2. The main program is PASCHGNW.EXE, first runs CHNGPASS.BAT to run net password to the PDC and get the error codes back; then calls PASSDLL.EXE to spawn the Windows Password Change Program with appropriate options. Finally, when everything is changed for the passwords, PASSSHUT.EXE is called to start a countdown timer and shut everything down/restart in 5 minutes, long enough for replication to occur from the PDC to the BDC.

  3. I tried compiling with the WBC options for BOTH PASSDLL and PASSSHUT but you CAN'T do a RUN to a WBC file, only a call. Unfortunately, a call will just sit there. I needed a way to spawn the program and then return to the main calling program.

  4. I did use the SMALL.EXE option for the compiling, so all three files take up about 240K or so, plus the NW3 Extender and the BATCH/PIF files. If you can think of a more efficient way to create the same effect, I'm all ears!
Mike

CHNGPASS.BAT:


@echo off

if "[%temp%]"=="[]" goto notemp
echo [ErrorLevel] > %temp%\errlevel.ini

rem ctty nul
net password \\cgyfwnsm01 %1 %2 %3
rem ctty con

if errorlevel 2244 goto e2244
if errorlevel 2243 goto e2243
if errorlevel 86 goto e86
if errorlevel 0 goto e0
:e2244
Echo Password has expired (2244)
echo EL=2244 >> %temp%\errlevel.ini
goto end
:e2243
Echo This user cannot change their password (2243)
echo EL=2243 >> %temp%\errlevel.ini
goto end
:e86
Echo Incorrect (initial) password (86)
echo EL=86 >> %temp%\errlevel.ini
goto end
:e0
Echo Everything seems ok (0)
echo EL=0 >> %temp%\errlevel.ini
goto end

:end

rem exit

PASCHGNW.WBT:


; add NetWare32 extender for NetWare functions
AddExtender("wwn3x34I.dll")

:begin
; IMPORTANT NOTE: In the text that follows there are a number of "nested"
; do-while and if-endif loops.	The indenting/spacing for the appropriate
; lines is CRITICAL and must NOT be changed.	 Mike Murphy
; Also, some of the lines in this text are WELL over 80 characters, this is
; not a problem as the Winbatch compiler will handle up to 255 character
; lines and they are mainly used for message windows and such.	The maximum
; length of a message Window (that will show up on the same line) is 120
; characters and for the AskPassWord window it is 45-48 characters depending
; on spacing of the text.				       Mike Murphy

; check FIRST to ensure TEMP Environment variable set, if not Terminate with descriptive error
tempvar=StrUpper(Environment("TEMP"))
Terminate(tempvar=="","NO TEMP Env var set",(StrCat("You MUST have a TEMP environment variable set for the Change Passwords Program to Work!",@CRLF,"Please contact your LAN Admin to fix this and give them this message.")))

SUPER="NO"

; set uname var to environment var for use in NET PASSWORD command
; get username variable from Registry key and insert into uname variable
;uname=RegQueryValue(@REGMACHINE, "Network\Logon\[username]")

; check FLAG files (in h:\network directory) for different conditions being forced
; if h:\network\forcpass.flg is there then FORCEPASS=YES and we are forcing down unique password

FORCEPASS=@NO

if FileExist("h:\network\forcpass.flg")==@TRUE then FORCEPASS=@YES
; set strike var to 0, increment by 1 each time password change fails, if this is done
; three times, then error out
strike=0
; create crlf var with Carriage return and Line feed, useful for messages
; create tab var for message spacing
crlf = StrCat(Num2Char(13), Num2Char(10))
tab = StrCat(Num2Char(9))
; initialize oldpw to String var.
; we will now do some elementary password checking to ensure that new password
; is long enough (6 chars or more) and old and new passwords are different

:beginask
ONCANCEL="GOTO BEGINASK"
if strike!=0 then gosub errormsg
oldpw = StrCat("olpw1","")
; get old password from user (AskPassword command is used as it "blanks the password")
oldpw = StrTrim(AskPassword("Old Password", "Please enter your old password"))

; new section added to force password to OUR known value if flag file exists; this will allow using
; the flag to force this at any time

if FORCEPASS==@FALSE then goto noforcepass

:FORCEPASS
; get username from Novell default server 
uname=n3GetUser(n3ServerList(1))
unamepass=StrLower(uname)
unamelen=StrLen(unamepass)
if unamelen > 6 then unamepass=StrFix(unamepass, "", 6)
unamelen=unamelen+8
unamepass=StrCat(unamepass,unamelen)
newpw1=unamepass
Display(3,"Forcing Unique Password","Your password is now being changed; creating a unique temporary password for you")
goto sendpass

:NOFORCEPASS
ONCANCEL="GOTO NOFORCEPASS"
Display(5,"VERY IMPORTANT!!", "Your new password must be at least 6 characters long and one that you have NOT used before!")
; initialize newpw1 and newpw2 vars to known string first and create loop
; waiting for user to enter password, used to validate password
newpw1 = StrCat("nwpw1","") 
newpw2 = StrCat("nwpw2","")
; initialize vars to create loop that checks if both pwds equal to each other
; for verification of correct double-entry
while newpw1!=newpw2
  newpw1 = StrCat("nwpw1","") 
  newpw2 = StrCat("nwpw2","")
;  ensure new password at least 6 chars long
  while StrLen(newpw1)<6
    newpw1 = StrTrim(AskPassword("New Password", "Please enter a new password"))
    if StrLen(newpw1)<6 then Display(5,"ERROR", "Your new password is not long enough. Please use a password 6 characters or longer!")
  endwhile
;  ensure that new password is different from old password
  if oldpw == newpw1
    Display(5,"ERROR", "Your old and new passwords are the same! Please try again!!")
    Continue
  Endif
  newpw2 = StrTrim(AskPassword("New Password", "Please verify your new password"))
  if newpw1!=newpw2 then Display(5,"ERROR", "Your new passwords did not match! Please re-enter your new passwords!")
endwhile

:SENDPASS

uname=n3GetUser(n3ServerList(1))
defserv=n3ServerList(1)
; check if in group testusers; this should be composed of all the supervisors
; and will now warn about connecting to ALL servers BEFORE changing passwords
If n3MemberGet(defserv,"SUPERVISORS",uname)==@TRUE then SUPER="YES"
If SUPER=="YES" then gosub warnsuper
; try changing password on primary server and check for pass or fail
RunHideWait('g:\batch\utils\chngpass.pif','%uname% %oldpw% %newpw1%')
ErrLevel=IniReadPvt("ErrorLevel","EL","","%tempvar%\errlevel.ini")
; if password check worked, send in, otherwise branch back to ask again and indicate error
If ErrLevel=="0" then goto PassOk
; IF n3chgpassword(defserv,uname,oldpw,newpw1)==@TRUE then goto PassOk
; increment strike by 1, three strikes and you're out!
strike=strike+1
goto beginask


; jump to here if password check OK
:PassOk

; once we get to here ALL of the (valid) Novell servers should have had their
; passwords changed; we will now call the Windows95 password change program

; at this point in the program, we have finished all the elementary password
; checking (our own checks)  We now send the password information to the password change
; program and wait to see what it will return.  To prevent user intervention, 
; we will initialize a status box to appear over EVERYTHING.  We will also use this
; box to pass status messgages onto the user

; This code should keep the following Window "on top" of the screen
; The idea will be to maximize this window (or make very large) so that
; you will display a status message and the user can't see what's going
; on behind the scenes.     Mike
; Set our windows to be on top

OurWnd=DllhWnd("")
xx=-1
DaDll=strcat(DirWindows(1),"USER32.DLL") 
DllCall(DaDll,long:"SetWindowPos",long:OurWnd,long:xx,long:0,long:0, long:0, long:0,long:3)

; initialize text color strings that we use for messages
t1="0,255,0" ;green text-for general messages
t2="255,0,0" ;red text-for error messages
t3="255,255,0" ;yellow text-for warning messages

BoxesUp("0,0,1000,1000", @zoomed)
;BoxesUp("50,50,950,950", @normal)
;BoxesUp("50,50,950,750", @normal)
BoxCaption(1, "Password Change Program")

; set color to green and msg and call subroutine
c=1
msg="Windows Password change program executing"
gosub showbox

ErrorMode(@OFF)
; initialize registry entries so that BOTH Windows and Novell password are changed, not NT or screensaver
; In [UseMasterKey] 00 00 00 00 clears the appropriate check box and
; 01 00 00 00 checks the appropriate check box
; turn ErrorMode off in case there is no MSNP32 installed, this will prevent error crashing
; turn off NT and Screen Saver passwords and turn on Netware Password (NW3)
RegSetBin(@REGMACHINE, "System\CurrentControlSet\Control\PwdProvider\MSNP32\[UseMasterKey]", "00 00 00 00")
RegSetBin(@REGMACHINE, "System\CurrentControlSet\Control\PwdProvider\SCRSAVE\[UseMasterKey]", "00 00 00 00")
;RegSetBin(@REGMACHINE, "System\CurrentControlSet\Control\PwdProvider\NDS\[UseMasterKey]", "00 00 00 00")
RegSetBin(@REGMACHINE, "System\CurrentControlSet\Control\PwdProvider\NWPASSWD\[UseMasterKey]", "01 00 00 00")
ErrorMode(@CANCEL)

; has DllCall inside wbc file

Run("passdll.exe","")
;Run("passdll.exe",(strcat(oldpw, " ", newpw1)))

;DllCall("c:\windows\system\mpr.dll", void:"PwdChangePasswordA",lpstr:"MSNP32", lpnull, long:0, long:0)

:passsend
While !WinExistChild("Change Windows Password","Con&firm new password")
 Delay(1)
EndWhile
; insert password variables into clipboard to allow pasting into dialog boxes
; the delay is necessary to allow time for the clipboard to fill before pasting
ClipPut("%oldpw%")
delay(1)
SendKeysTo("Change Windows Password", "!o^v{TAB}")
ClipPut("%newpw1%")
 delay(1)
SendKeysTo("Change Windows Password", "^v{TAB}")
 delay(1)
SendKeysTo("Change Windows Password", "^v{TAB}")
 delay(1)
SendKeysTo("Change Windows Password", "{SP}")
 delay(1)
While !WinExistChild("Netware Password Synchronization","&Invert")
 Delay(1)
EndWhile
SendKeysChild("Netware Password Synchronization", "&Invert", "{SP}")
 Delay(1)
SendKeysTo("Netware Password Synchronization","{SP}")
While!WinExistChild("Microsoft Windows","The Windows password has been successfully changed.")
 Delay(1)
EndWhile
SendKeysChild("Microsoft Windows","The Windows password has been successfully changed.","{SP}")

; if we reach this point, both passwords used were valid, that is the old
; password was the right one and the new passwords were valid as well.  We
; can now use the valid passwords to change any other NT domains and servers in the
; next section and generate a message to the user that indicates success

; extract the login domain from the registry so that the NT password gets changed on
; the right server; shlott is \\shlottb1 and shlcorp is \\cgyfwnsm01
logdomain="none"
regdomname=RegQueryValue(@REGMACHINE, "System\CurrentControlSet\Services\MSNP32\NetworkProvider\[AuthenticatingAgent]")
If StriCmp("shlcorp",regdomname)==0 then logdomain="shlcorp"
If StriCmp("shlott",regdomname)==0 then logdomain="shlott"

; put ANY NT Domain or server changes after this comment line, recommend using
; RunHideWait to insulate the user from background happenings
; this is especially important in the case of trying to change a password on
; a computer you do NOT log into, this way the same batch file can be used for
; both Secure Area and Online Knowledge Group users
;If StriCmp("shlcorp",regdomname)==0 then RunHide("net.exe","password \\cgyfwnsm01 %uname% %oldpw% %newpw1%")
;If StriCmp("shlott",regdomname)==0 then RunHide("net.exe","password \\shlottb1 %uname% %oldpw% %newpw1%")
;RunHide("net.exe","password \\cgyfwnsm01 %uname% %oldpw% %newpw1%")
;RunHide("net.exe", "password /domain:shlott %uname% %oldpw% %newpw1%")
If n3MemberGet(defserv,"SECURE6",uname)==@TRUE then RunHide("net.exe", "password \\shlottfwsec1 %uname% %oldpw% %newpw1%")
If n3MemberGet(defserv,"OTT_METH",uname)==@TRUE then RunHide("net.exe", "password \\tranprod %uname% %oldpw% %newpw1%")
;RunHide("net.exe", "password \\thelpserver %uname% %oldpw% %newpw1%")
BoxDestroy(1)
Display(4,"THIS WINDOW  WILL CLOSE ON IT'S OWN","Successful Password Change%crlf%%crlf%ALL Password(s) Successfully Changed!!%crlf%%crlf%NOTICE: You will NOT be able to access O: drive, Transform or Mail for at least 5 minutes")

; try and avoid the SEVERE problems that come from losing password sync.

; now that the password has been successfully changed, we will update the TWO flag files in the
; h:\network directory; copy G:\BATCH\PASSLEVN.BAT to/over h:\network\PASSLEVH.BAT (flag file forcing
; you to change passwords; add/append date of password change to H:\NETWORK\PASSCHNG.LST
; this will also delete the flag file forcpass.flg from the h:\network directory

; this routine will take the data from the passlevn file, change the passlevn to
; passlevh and then put this info into passlevh.bat file in h:\network

PassLn=FileOpen("g:\batch\passlevn.bat","Read")
PassLevn=FileRead(PassLn)
FileClose(PassLn)
PassLevh=StrReplace(Passlevn,"PASSLEVN","PASSLEVH")
PassLh=FileOpen("h:\network\passlevh.bat","Write")
FileWrite(PassLh,PassLevh)
FileClose(PassLh)

PassChng=FileOpen("h:\network\passchng.txt","Append")
CurTime=TimeDate()
FileWrite(PassChng, CurTime)
FileClose(PassChng)
if FORCEPASS==@FALSE then goto nopassmsg
If FileExist("h:\network\forcpass.flg")==@TRUE then FileDelete("h:\network\forcpass.flg")
msghdr="	PLEASE CLOSE THIS WINDOW AFTER YOU HAVE NOTED YOUR PASSWORD   "
msg1="Your new unique TEMPORARY password is listed below%crlf%"
msg2="New temporary password is%crlf%%crlf%%crlf%%tab%%tab%%tab%%unamepass%%crlf%%crlf%%crlf%Please make a note of this."
msg3="%crlf%%crlf%Click the OK button to close this box"
Message("%msghdr%","%msg1%%msg2%%msg3%")

:nopassmsg

; this routine was added in to force a shutdown to wait until the passwords are synchronized
; on ALL the NT servers, we will wait 5 minutes and shutdown (using the shutdown.exe program
; in order to have a timer on the screen.  Then with a restart this should buy us about 7-8
; minutes and everything SHOULD be ok by then.

OurWnd=DllhWnd("")
xx=-1
DaDll=strcat(DirWindows(1),"USER32.DLL") 
DllCall(DaDll,long:"SetWindowPos",long:OurWnd,long:xx,long:0,long:0, long:0, long:0,long:3)

; initialize text color strings that we use for messages
t1="0,255,0" ;green text-for general messages
t2="255,0,0" ;red text-for error messages
t3="255,255,0" ;yellow text-for warning messages

BoxesUp("150,150,850,850", @normal)
;BoxesUp("50,50,950,750", @normal)
BoxCaption(1, "Password Change Program-Shutdown Routine")

; set color to green and msg and call subroutine
c=3

msg1="You have just changed your password."
msg2="In order to avoid any problems with (password) synchronizing,"
msg3="the system will now wait 5 minutes and then restart Windows."
msg4="This would be a good time to go and get a coffee!"
msg5="Please do NOT cancel this process; let the system restart."
msg6="Cancelling may cause you to have trouble accessing"
msg7="Mail, the O: drive and Transform!"
msg8="You will now see a timer on your screen with the time until shutdown"
msg9="You should not touch anything until the system has rebooted"
msg10="Thank you for your co-operation."
msginit=(StrCat(msg1,"  ",msg2," ",msg3,"	",msg4))
msgwrn=(StrCat(msg5,"	 ",msg6," ",msg7))
msgfin=(StrCat(msg8,"  ",msg9,@CRLF,"     ",msg10))
gosub showbox2
; spawn separate program to create timed shutdown, meanwhile backup inis and exit
RunHide("passshut.exe","")
;Run("g:\batch\utils\shutdown.exe","/t:5 /restart /force")
TimeDelay(3)
BoxDestroy(1)
gosub copyinis
exit

; beginning of subroutines, end of normal code

:showbox
     BoxColor(1,"255,0,0",6)   ;sets the background color
     BoxDrawRect(1,"0,0,1000,1000",2)   ;object which will use the color
     BoxTextColor(1,"0,255,0")
     BoxTextFont(1,"Times Roman", 75, 70, 18)
     BoxDrawText(1, "150,150,850,300", "Please do NOT touch keyboard or mouse", @False, 1)
     BoxTextColor(1,t%c%)
     BoxTextFont(1,"Helvetica", 65, 80, 34)
     BoxDrawText(1, "150,600,850,600", "%msg%", @TRUE, 1)
return

; this section is used to "intercept" the cancel command from the program
; and return control to the beginning; if the user is in the SUPERVISORS group 
; then the cancel command is allowed.

:CANCEL
IF SUPER=="YES" then EXIT
Display(3,"This function disabled","Sorry, not allowed to cancel out of this function.")
%ONCANCEL%
EXIT

:errormsg
  ; this subroutine will send appropriate error messages depending on how many times the user
  ; has tried to change their password, if 3 time (strikes) it will exit
if strike==1
 if ErrLevel==86
  hdr=("Wrong Initial Password")
  msg=("I'm Sorry, you used the wrong OLD password, please try again")
 endif
 if ErrLevel==2244
  hdr=("Password has already been used")
  msg=("I'm sorry, that password has been used before; please choose a different one.")
 endif
endif
if strike==2
 if ErrLevel==86
  hdr=("Wrong Initial Password")
  msg=("I'm Sorry, you used the wrong OLD password, please try and remember the right one.")
 endif
 if ErrLevel==2244
  hdr=("Password has already been used")
  msg=("I'm sorry, that password has been used before; please choose a COMPLETELY different one.")
 endif
endif
if strike==3
 if ErrLevel==86
  hdr=("Wrong Initial Password")
  msg=("I'm Sorry, you used the WRONG OLD PASSWORD, we can't change your password at this time.")
 endif
 if ErrLevel==2244
  hdr=("Password has already been used")
  msg=("I'm sorry, that password has been used before; we can't change your password at this time.")
 endif
endif
  Display(5,hdr,msg)
  if strike==3 then gosub seeya
return

:seeya
  ; 3 bad password attempts in a row, save status, send message to LAN Admins and exit
  PassChng=FileOpen("h:\network\passchng.txt","Append")
  CurTime=TimeDate()
  FileWrite(PassChng, "Problems changing password at %CurTime%")
  FileClose(PassChng)
  ErrorMsg=StrCat("Pass probs: ",uname," on ",defserv,"at ",curtime)
; the message will now be broadcast to ALL Admins logged in on the server where the user is
; having problems.  The ErrorMode(@OFF) is used as some of the ID's DON'T exist on ALL servers
  ErrorMode(@OFF)
  n3MsgSend(defserv, ErrorMsg, "fred")
  n3MsgSend(defserv, ErrorMsg, "tom")
  n3MsgSend(defserv, ErrorMsg, "dick")
  n3MsgSend(defserv, ErrorMsg, "harry")

  ErrorMode(@CANCEL)
  exit
return

:warnsuper
  ;this subroutine will create an itemized list of the servers along with a
  ; warning message so that the supervisor equiv. user can see if they are
  ; connected to ALL their servers or if they want to exit and reconnect
  servers=n3ServerList(0)
  ; set variable to indicate number of attached servers
  Numservs=ItemCount(servers,@TAB)
  wrnmsghdr="      WARNING MESSAGE TO SUPERVISORS   "
  wrnmsg1="You should ensure that you are connected to ALL of your file servers before changing passwords%crlf%"
  wrnmsg2="You will now see a list of currently attached servers that you are attached to%crlf%%crlf%%crlf%Please make a note of this."
  wrnmsg3="%crlf%%crlf%Click the OK button to continue or the Cancel button to exit and attach to other servers"
  wrnmessage=StrCat(wrnmsg1,wrnmsg2,wrnmsg3)
  Display(5,wrnmsghdr,wrnmessage)
  ServList=ItemSelect("Current Attached Servers",servers,@TAB)
return

; subroutine to create a message window warning the user about the impending shutdown
:showbox2
     BoxColor(1,"255,0,0",6)   ;sets the background color
     BoxDrawRect(1,"0,0,1000,1000",2)	;object which will use the color
     BoxTextColor(1,"0,255,0")
     BoxTextFont(1,"Times Roman", 40, 70, 18)
     BoxDrawText(1, "150,150,850,200", msginit, @FALSE, 16)
     BoxTextColor(1,t3)
     BoxTextFont(1,"Helvetica", 40, 80, 34)
     TimeDelay(6)
     BoxDrawText(1, "150,400,850,500", msgwrn, @FALSE, 16)
     BoxTextColor(1,t2)
     BoxTextFont(1,"Helvetica", 40, 80, 34)
     TimeDelay(6)
     BoxDrawText(1, "150,600,850,600", msgfin, @FALSE, 16)
return

; subroutine to copyini files back to H: drive before shutting down
:copyinis
drive = "H:"

	  if DiskExist(drive)
	    ErrorMode(@OFF)
	    if FileExist ("h:\exchange\mailbox.pab") != 2
	      if FileExist ("c:\exchange\mailbox.pab") then FileCopy ("C:\EXCHANGE\MAILBOX.PAB", "H:\EXCHANGE\MAILBOX.PAB",@FALSE)
	    endif
	    if FileExist ("h:\windows\session.ini") != 2 
	      if FileExist ("c:\windows\session.ini") then FileCopy ("C:\WINDOWS\SESSION.INI", "H:\WINDOWS\SESSION.INI",@FALSE)
	    endif	  
	    if FileExist ("h:\windows\msmail.ini") != 2 
	      if FileExist ("c:\windows\msmail.ini") then FileCopy ("C:\WINDOWS\MSMAIL.INI", "H:\WINDOWS\MSMAIL.INI",@FALSE)
	    endif	  
	    if FileExist ("h:\windows\trs.ini") != 2 
	      if FileExist ("c:\windows\trs.ini") then FileCopy ("C:\WINDOWS\TRS.INI", "H:\WINDOWS\TRS.INI",@FALSE)
	    endif	  
	    if FileExist ("h:\faxsrcli\faxsrwin.ini") != 2 
	      if FileExist ("c:\Program Files\faxsrcli\faxsrwin.ini") then FileCopy ("C:\PROGRAM FILES\FAXSRCLI\FAXSRWIN.INI", "H:\FAXSRCLI\FAXSRWIN.INI",@FALSE)
	    endif	  
	    if FileExist ("h:\windows\odbc.ini") != 2 
	      if FileExist ("c:\windows\odbc.ini") then FileCopy ("C:\WINDOWS\ODBC.INI", "H:\WINDOWS\ODBC.INI",@FALSE)
	    endif	  
	    if FileExist ("h:\windows\ers.ini") != 2 
	      if FileExist ("c:\windows\ers.ini") then FileCopy ("C:\WINDOWS\ERS.INI", "H:\WINDOWS\ERS.INI",@FALSE)
	    endif	  
	    if FileExist ("h:\windows\shltrans.ini") != 2 
	      if FileExist ("c:\windows\shltrans.ini") then FileCopy ("C:\WINDOWS\SHLT*.INI", "H:\WINDOWS\SHLT*.INI",@FALSE)
	    endif	  
	    if FileExist ("h:\windows\msacc20.ini") != 2 
	      if FileExist ("c:\windows\msacc20.ini") then FileCopy ("C:\WINDOWS\MSACC20.INI", "H:\WINDOWS\MSACC20.INI",@FALSE)
	    endif	  
	    if FileExist ("h:\windows\winproj4.ini") != 2 
	      if FileExist ("c:\windows\winproj4.ini") then FileCopy ("C:\WINDOWS\WINPROJ4.INI", "H:\WINDOWS\WINPROJ4.INI",@FALSE)
	    endif	  
	    if FileExist ("h:\windows\pww.ini") != 2 
	      if FileExist ("c:\windows\pww.ini") then FileCopy ("C:\WINDOWS\PWW.INI", "H:\WINDOWS\PWW.INI",@FALSE)
	    endif	  
	    ErrorMode(@CANCEL)
	  endif
return

; the following code can be used while debugging the program, it is used to
; tell the name of ALL open windows (WinItemize) or to show the name of child
; windows (WinItemchild) after learning the name of the parent using WinItemize

;while AskYesNo("Wincheck","Check another Window?")
; allwins=Winitemize()
; htab=Num2Char(9)
; mywind=AskItemList("Windows",allwins,htab,@unsorted,@single)
; children=WinItemChild(mywind)
; a=strreplace(children, @tab, @crlf)
; message(mywind, a)
;endwhile



PASSDLL.WBT:


; this should call the password change program and input the parm automatically
;DllCall("c:\windows\system\mpr.dll", void:"PwdChangePasswordW",lpstr:"MSNET32", lpnull, long:0, long:0)
DllCall("c:\windows\system\mpr.dll", void:"PwdChangePasswordA",lpstr:"NWPASSWD", lpnull, long:0, long:0)
return

PASSSHUT.WBT:


; next line supposed to hide Icon, but comes back with Box commands
;IntControl(1002,0,0,0,0)
BoxOpen("Password Change Program-Timed Shutdown","")

mins=4
while mins > -1
delim=":"
secs=59
while secs > -1
BoxText(strcat(@crlf,"Timed Shutdown in progress...",@crlf,@crlf,@crlf,"    ","T  minus","    ","    ",mins,delim,secs,"    ","    ","minute(s)",":","second(s)",@crlf))
TimeDelay(1)
secs=secs-1
if secs<10 then delim=":0"
endwhile
mins=mins-1
endwhile
BoxShut()
IntControl(67,0,0,0,0)
exit


Article ID:   W13302
Filename:   Change Network Password Sample.txt
File Created: 2001:03:01:13:19:52
Last Updated: 2001:03:01:13:19:52