Link to home
Start Free TrialLog in
Avatar of shoris
shoris

asked on

VB Script = Add User to the local Machine

For some reason this script may be old.. Does the job when i add the computer to the local admin groups on the computer. But now each time the computer boots up, the script runs .. how can i hide the script giving the error message or adjust it that it works properly

I have this script as a startup script from my AD 2003 - basically adding the Administrator from the OU to the local admin acocunt on the computer.

Dim oGrpLocal
On Error Resume Next
Set oGrpLocal = GetObject ("WinNT://./administrators,group")
If err.Number <> 0 then
   WScript.Quit
End If
'The DOMAIN below is the netbios domain name, and OULocalAdmins is the name of the group you
'want to add to the local administrators group.
If Not oGrpLocal.IsMember("WinNT://DOMAIN/OULocalAdmins") Then
   oGrpLocal.Add "WinNT://DOMAIN/OULocalAdmins"
End If
ASKER CERTIFIED SOLUTION
Avatar of chandru_sol
chandru_sol
Flag of India image

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