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
kbjijoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

KimputerCommented:
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.
0
kbjijoAuthor Commented:
is there any other way to check the password 123456 is correct or not ?
0
KimputerCommented:
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.
0
Angular Fundamentals

Learn the fundamentals of Angular 2, a JavaScript framework for developing dynamic single page applications.

kbjijoAuthor Commented:
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
0
kbjijoAuthor Commented:
Hi Guys any more suggestion ?
0
kbjijoAuthor Commented:
HI All... Thanks for your support... I got a solution for this issue..
-----------------------------------------------------------------------------------------------------------------
Set fso = CreateObject("Scripting.FileSystemObject")
 Set WshNetwork = WScript.CreateObject("WScript.Network")
 
 username = "Administrator"
 password = "P@ssworD"
 objComput = WshNetwork.ComputerName
 

 on error resume next
 WshNetwork.MapNetworkDrive "R:", "\\" & objComput & "\C$",false, objComput & "\" & username, password
 
 If fso.FolderExists("R:\Windows") Then
     wscript.echo "Credentials OK"
 Else
     Wscript.Echo "Credentials Bad"
 End If
WshNetwork.RemoveNetworkDrive "R:"
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kbjijoAuthor Commented:
Found the answer by Search :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.