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.

Check User's Password and Username

Keywords: 	 Check User's Password and Username  validate password	nwrdr.sys rdr.sys

Question:

How do I check a user's password and username?

Answer:

I figured out how to do this. I went out to Microsoft and found they know about the problem also. There is a file nwrdr.sys for win 2000 and rdr.sys for NT. What you have to do is login as admin (Local) Then back up that file. Now every time you map a drive with a different user just copy the file back. This file holds the login information and does not release it.

Below is my script.

Display(1, "Check user","This program is going to check the users password and user name")

; Adds Extenders
:main
AddExtender("WWWNT32I.DLL")
AddExtender("wwwnt32i.dll")
AddExtender("WWSOP32I.DLL")

ininame = "C:\passwordlogs\password.ini"
SRN = IniReadPvt("user", "SalaryRoleNum", "", ininame)
UserId = IniReadPvt("user", "UserId", "", ininame)
Password=IniReadPVT("user", "password","",ininame)
orgfile="C:\WINNT\system32\drivers\nwrdr.sys"
temp="C:\TEMP\nwrdr.sys"
back="C:\TEMP\baknwrdr.sys"
x=5+1


; Makes a copy and a back up copy of nwrdr.sys
nwr=fileexist ("C:\TEMP\nwrdr.sys")
if FileItemize (nwr)==("C:\TEMP\nwrdr.sys") 
FileCopy(temp,orgfile,@false)
goto password
;else
FileCopy(orgfile,temp,@false)
FileCopy(orgfile,back,@false)
goto password
endif


; Logs into share to retrieve list
:password 
thisfile=Fileexist("C:\passwordlogs\password.ini") 
if FileItemize (thisfile)==("C:\passwordlogs\password.ini") 
goto chkpwd
else
FileCopy(temp,orgfile,@false)
;wntAddDrive(@default,@default,"\\server\Logs\password",@none, @false)
wntAddDrive("general", "","\\server\Logs\password",@none, @false)
FileCopy("\\server\logs\password\password.ini", "C:\passwordlogs\password.ini", @False)
wntCancelCon("\\server\logs\password",@TRUE,@TRUE)
FileCopy(temp,orgfile,@false)
goto chkpwd
endif


; Check Password for each user
:chkpwd
ininame = "C:\password.ini"
SRN = IniReadPvt("user", "SalaryRoleNum", "", ininame)
UserId = IniReadPvt("user", "UserId", "", ininame)
Password=IniReadPVT("user", "password","",ininame)
orgfile="C:\WINNT\system32\drivers\nwrdr.sys"
temp="C:\TEMP\nwrdr.sys"
back="C:\TEMP\baknwrdr.sys"
a=(x)-1
x=a

FileCopy(temp,orgfile,@false)
ErrorMode(@OFF)
wntAddDrive("%UserId%", "%Password%","\\server",@None, @false)
ErrorMode(@CANCEL)
drive="\\server\logs\password\password.ini"

;If DirExist("%drive%:\") then yes
filetest="\\server\logs\password\password.ini"
if FileExist("%drive%") 
FileCopy(temp,orgfile,@false)
goto yes
else 
FileCopy(temp,orgfile,@false)
goto no
endif

; Creates a Pass Log and Main Log
:yes
mainfile = "C:\passwordlogs\mainpassword.log" 
flag=FileOpen(mainfile, "append")
time=timedate()
file=FileWrite(flag, "%SRN%,%UserId%,%Password%,%time%,Pass")
FileClose(flag) 
goodfile = "C:\passwordlogs\Good_password.log" 
gflag=FileOpen(goodfile, "append")
time=timedate()
gfile=FileWrite(gflag, "%SRN%,%UserId%,%Password%,%time%,Pass")
FileClose(gflag) 

if a<>"0" then
goto chkpwd
else 
goto end
endif


; Creates a Fail Log and Main Log
:no
mainfile = "C:\passwordlogs\mainpassword.flg" 
flag=FileOpen(mainfile, "append")
time=timedate()
file=FileWrite(flag, "%SRN%,%UserId%,%Password%,%time%,Fail")
FileClose(flag) 
badfile = "C:\passwordlogs\ Bad_password.flg" 
bflag=FileOpen(badfile, "append")
btime=timedate()
bfile=FileWrite(bflag, "%SRN%,%UserId%,%Password%,%time%,Fail")
FileClose(bflag) 

if a<>"0" then
goto chkpwd
else 
goto end
endif

; Exit statement, Copies files to network and deletes them from your Hard Drive
:end 
if fileexist ("C:\TEMP\nwrdr.sys")
FileCopy(temp,orgfile,@false)
;wntAddDrive(@default,@default,"\\server\Logs\password",@none, @false)
wntAddDrive("general", "","\\server\Logs\password",@none, @false) 
FileCopy("C:\passwordlogs\mainpassword.log","\\server\logs\password\mainpasswordlog.log",@TRUE)
FileCopy("C:\passwordlogs\Bad_password.log","\\server\logs\password\Bad_password.log",@TRUE)
FileCopy("C:\passwordlogs\Good_password.flg","\\server\logs\password\Good_password.log",@TRUE)
wntCancelCon("\\server\logs\password\",@TRUE,@TRUE)
display(20,"Password Checker","The Program is complete. Please check log files for resultes.")
exit
filedelete ("C:\TEMP\nwrdr.sys")
filedelete ("C:\TEMP\baknwrdr.sys")
display(20,"Password Checker","The Program is complete. Please check log files for resultes.")
exit
else
FileCopy(temp,orgfile,@false)
;wntAddDrive(@default,@default,"\\server\Logs\password",@none, @false)
wntAddDrive("general", "","\\server\Logs\password\",@none, @false)
FileCopy("C:\passwordlogs\mainpassword.log","\\server\logs\password\mainpasswordlog.log",@TRUE)
FileCopy("C:\passwordlogs\Bad_password.log","\\server\logs\password\Bad_password.log",@TRUE)
FileCopy("C:\passwordlogs\Good_password.log","\\server\logs\password\Good_password.log",@TRUE)
wntCancelCon("\\server\logs\password\",@TRUE,@TRUE)
display(20,"Password Checker","The Program is complete. Please check log files for resultes.")
exit
endif
Display(1, "Check user","This program is gooing to check the users password and user name")

; Adds Extenders
:main
AddExtender("WWWNT32I.DLL")
AddExtender("wwwnt32i.dll")
AddExtender("WWSOP32I.DLL")

ininame = "C:\passwordlogs\password.ini"
SRN = IniReadPvt("user", "SalaryRoleNum", "", ininame)
UserId = IniReadPvt("user", "UserId", "", ininame)
Password=IniReadPVT("user", "password","",ininame)
orgfile="C:\WINNT\system32\drivers\nwrdr.sys"
temp="C:\TEMP\nwrdr.sys"
back="C:\TEMP\baknwrdr.sys"
x=5+1


; Makes a copy and a back up copy of nwrdr.sys
nwr=fileexist ("C:\TEMP\nwrdr.sys")
if FileItemize (nwr)==("C:\TEMP\nwrdr.sys") 
FileCopy(temp,orgfile,@false)
goto password
;else
FileCopy(orgfile,temp,@false)
FileCopy(orgfile,back,@false)
goto password
endif


; Logs into share to retrieve list
:password 
thisfile=Fileexist("C:\passwordlogs\password.ini") 
if FileItemize (thisfile)==("C:\passwordlogs\password.ini") 
goto chkpwd
else
FileCopy(temp,orgfile,@false)
;wntAddDrive(@default,@default,"\\server\Logs\password",@none, @false)
wntAddDrive("general", "","\\server\Logs\password",@none, @false)
FileCopy("\\server\logs\password\password.ini", "C:\passwordlogs\password.ini", @False)
wntCancelCon("\\server\logs\password",@TRUE,@TRUE)
FileCopy(temp,orgfile,@false)
goto chkpwd
endif


; Check Password for each user
:chkpwd
ininame = "C:\password.ini"
SRN = IniReadPvt("user", "SalaryRoleNum", "", ininame)
UserId = IniReadPvt("user", "UserId", "", ininame)
Password=IniReadPVT("user", "password","",ininame)
orgfile="C:\WINNT\system32\drivers\nwrdr.sys"
temp="C:\TEMP\nwrdr.sys"
back="C:\TEMP\baknwrdr.sys"
a=(x)-1
x=a

FileCopy(temp,orgfile,@false)
ErrorMode(@OFF)
wntAddDrive("%UserId%", "%Password%","\\server",@None, @false)
ErrorMode(@CANCEL)
drive="\\server\logs\password\password.ini"

;If DirExist("%drive%:\") then yes
filetest="\\server\logs\password\password.ini"
if FileExist("%drive%") 
FileCopy(temp,orgfile,@false)
goto yes
else 
FileCopy(temp,orgfile,@false)
goto no
endif

; Creates a Pass Log and Main Log
:yes
mainfile = "C:\passwordlogs\mainpassword.log" 
flag=FileOpen(mainfile, "append")
time=timedate()
file=FileWrite(flag, "%SRN%,%UserId%,%Password%,%time%,Pass")
FileClose(flag) 
goodfile = "C:\passwordlogs\Good_password.log" 
gflag=FileOpen(goodfile, "append")
time=timedate()
gfile=FileWrite(gflag, "%SRN%,%UserId%,%Password%,%time%,Pass")
FileClose(gflag) 

if a<>"0" then
goto chkpwd
else 
goto end
endif


; Creates a Fail Log and Main Log
:no
mainfile = "C:\passwordlogs\mainpassword.flg" 
flag=FileOpen(mainfile, "append")
time=timedate()
file=FileWrite(flag, "%SRN%,%UserId%,%Password%,%time%,Fail")
FileClose(flag) 
badfile = "C:\passwordlogs\ Bad_password.flg" 
bflag=FileOpen(badfile, "append")
btime=timedate()
bfile=FileWrite(bflag, "%SRN%,%UserId%,%Password%,%time%,Fail")
FileClose(bflag) 

if a<>"0" then
goto chkpwd
else 
goto end
endif

; Exit statement, Copies files to network and deletes them from your Hard Drive
:end 
if fileexist ("C:\TEMP\nwrdr.sys")
	FileCopy(temp,orgfile,@false)
	;wntAddDrive(@default,@default,"\\server\Logs\password",@none, @false)
	wntAddDrive("general", "","\\server\Logs\password",@none, @false) 

	FileCopy("C:\passwordlogs\mainpassword.log","\\server\logs\password\mainpasswordlog.log",@TRUE)
	FileCopy("C:\passwordlogs\Bad_password.log","\\server\logs\password\Bad_password.log",@TRUE)
	FileCopy("C:\passwordlogs\Good_password.flg","\\server\logs\password\Good_password.log",@TRUE)

	wntCancelCon("\\server\logs\password\",@TRUE,@TRUE)
	display(20,"Password Checker","The Program is complete. Please check log files for resultes.")
	exit

	filedelete ("C:\TEMP\nwrdr.sys")
	filedelete ("C:\TEMP\baknwrdr.sys")

	display(20,"Password Checker","The Program is complete. Please check log files for resultes.")
	exit

else
	FileCopy(temp,orgfile,@false)
	;wntAddDrive(@default,@default,"\\server\Logs\password",@none, @false)
	wntAddDrive("general", "","\\server\Logs\password\",@none, @false)

	FileCopy("C:\passwordlogs\mainpassword.log","\\server\logs\password\mainpasswordlog.log",@TRUE)
	FileCopy("C:\passwordlogs\Bad_password.log","\\server\logs\password\Bad_password.log",@TRUE)
	FileCopy("C:\passwordlogs\Good_password.log","\\server\logs\password\Good_password.log",@TRUE)

	wntCancelCon("\\server\logs\password\",@TRUE,@TRUE)
	display(20,"Password Checker","The Program is complete. Please check log files for results.")
	exit
endif

Article ID:   W14940
File Created: 2001:11:08:12:41:02
Last Updated: 2001:11:08:12:41:02