On error resume next on encoded VB script



Hello,

I have a vb script that changes the local admin password of a
machine. My company has offices in U.S. and Canada so we have two
different usernames for the local admin account, one in English one in
French depending on where you are located. My script tries to change
the password for both. I have it set to resume if there is an error
since only one of the usernames will actually work. The program works
fine as a vbscript but after using the Windows Script Encoder it fails
if the first username that it tries to change doesn't exist. No I
can't have just one username, we have to have one in English and
French.

Here is the code (the only thing I changed was the actuall password
and usernames:
------------------------------------------------------------------------------------------
Set WshNetwork = WScript.CreateObject("WScript.Network")
strComputer = WshNetwork.ComputerName
strPSWD = "Password"

'If username does not exist ignore error
On Error Resume Next

'Change password for French local admin account
Set objUser = GetObject("WinNT://" & strComputer & "/Frenchname,user")
If Err.Number = 0 Then
objUser.SetPassword strPSWD
objUser.SetInfo
End If

'Change password for English local admin account
Set objUser = GetObject("WinNT://" & strComputer & "/
Englishname,user")
If Err.Number = 0 Then
objUser.SetPassword strPSWD
objUser.SetInfo
End If

Err.Clear
--------------------------------------------------------------------------------------------------------------
.



Relevant Pages

  • Re: On error resume next on encoded VB script
    ... I have a vb script that changes the local admin password of a ... My script tries to change ... since only one of the usernames will actually work. ... objUser.SetPassword strPSWD ...
    (microsoft.public.vb.general.discussion)
  • Re: On error resume next on encoded VB script
    ... I have a vb script that changes the local admin password of a ... My script tries to change ... since only one of the usernames will actually work. ... 'Change password for French local admin account ...
    (microsoft.public.vb.general.discussion)
  • Re: Changing the local admin password base on the computers OU
    ... The intent is to put thsi script in a GPO that runs everytime the ... allowing us to cahnge local admin passwords pretty ... Your script appears to check for group membership. ... object and use the Parent method to retrieve the ADsPath of the parent ...
    (microsoft.public.scripting.vbscript)
  • RE: Changing local admin PW using vb logon script - can it be encrypted?
    ... > True enough, but to quote a tall, hairy dewd I've worked with ... > will only buy you 5 minutes while they search for the script ... I missed the tall hairy "dewd" reference, and I agree that security must ... local admin ought to have more protection than that. ...
    (Focus-Microsoft)
  • RE: Changing local admin PW using vb logon script - can it be encrypted?
    ... renaming the admin account is relatively weak "security by ... Subject: RE: Changing local admin PW using vb logon script - can it be ... > balance between functionality and protection". ...
    (Focus-Microsoft)