Have a problem that seems simple but is driving me insane and would be very grateful if someone could give me some assistance. What I need is to verify a command executes or not. The command in strCommand has the incorrect username and password and errors out if I do it on the command line. But, for some reason Err.Number always returns 0. Am I not catching the error correctly?
Let me say ultimately what I am trying to do is verify a username and password on a remote machine, if the username and password is not correct then I am going to set it to another username and password. The issue is that we have some machines with an administrator username of xxxx and other machines with a administrator username of yyyy...I need to identify which is the correct username and password so I can execute additional script....I mention this in case someone has a better way of doing this....
Let me say ultimately what I am trying to do is verify a username and password on a remote machine, if the username and password is not correct then I am going to set it to another username and password. The issue is that we have some machines with an administrator username of xxxx and other machines with a administrator username of yyyy...I need to identify which is the correct username and password so I can execute additional script....I mention this in case someone has a better way of doing this....
Code:
On Error Resume Next
Dim WshShell, strCommand
Set WshShell = Wscript.CreateObject("Wscript.Shell")
strCommand = "NET USE \\libvgtrts\IPC$ /USER:local\admin hello123"
WshShell.Run strcommand, 0, true
wscript.echo Err.Number