I am trying to write a script that will go through a list of computers and check that the local admin password is what it should be set to. I am trying to use .ChangePassword and resetting the password to itself so I know that's the right password, if its not then it should display Bad Password. However when testing on a machine I am certain the password is right I am still gettting an error '-2147023569'. Any ideas?
Code:
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
Code:
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