Link to home
Start Free TrialLog in
Avatar of kbjijo
kbjijo

asked on

VBscript to check the local administrator password is set to correct

Hi friends,

Could anybody help me to create a vbscript which helps me to check the local administrator has been set with the correct password.. I got lot of referance which will do the password reset, but my requirment is to just varify and give a reply..

i got the below script from other site but it gives me an error -2147023569'
--------------------------------------------------------------------------------------------------------
oDomain = "TestComputer"
oUser = "Administrator"
oPassword = "123456"


Set objUser = GetObject("WinNT://" & oDomain & "/" & oUser & ", user" )

if err.number <> 0 then
msgbox "Login Error"
end if

on error resume next

objUser.ChangePassword oPassword, oPassword
if err.number <> 0 then
msgbox "BAD PASSWORD!"
msgbox err.number
else
msgbox "Good Password"
end if
Avatar of Kimputer
Kimputer

if you only want to check the password, remove this code:

on error resume next

objUser.ChangePassword oPassword, oPassword
if err.number <> 0 then
msgbox "BAD PASSWORD!"
msgbox err.number
else
msgbox "Good Password"
end if

Open in new window


That's the part that's changing the password (doesn't work anyway, the code is wrong).
So it means, after the change, NO prompt means, PASSWORD CHECKS OUT OK. Only when you get the prompt, it means the password is incorrect.
Avatar of kbjijo

ASKER

is there any other way to check the password 123456 is correct or not ?
Password are saved as a hash, which means it's not reversible (unless you dug into the advanced settings and set it to the UNSAFE reversible method). That means, the only way to know if a password is good or not is to use it, and get the response ok or not ok from the system, and that's exactly what the first part of the script is doing.
Avatar of kbjijo

ASKER

thanks for your reply..

but the first part check only the user.. i need to confirm the user password also.. is there any way to run a file with runas and grab the output
Avatar of kbjijo

ASKER

Hi Guys any more suggestion ?
ASKER CERTIFIED SOLUTION
Avatar of kbjijo
kbjijo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kbjijo

ASKER

Found the answer by Search :)