Tom's Hardware > Forum > Windows XP > Configuration & Customize > Add a Domain user to Local Admin Group via vb script
Word :    Username :           
 

I need to find a way to add a Domain user to all the PC's Local Admin Group via a vb script. I found this script that was posted in 2004 and seems to do just what I need.
************************************
Set oWshNet = CreateObject("WScript.Network" )

sUser = "fill in some domain user name here"

sNetBIOSDomain = oWshNet.UserDomain
sComputer = oWshNet.ComputerName

Set oGroup = GetObject("WinNT://" & sComputer & "/Administrators,group" )
Set oUser = GetObject("WinNT://" & sNetBIOSDomain & "/" & sUser & ",user" )

' suppress errors in case the user is already a member
On Error Resume Next
oGroup.Add(oUser.ADsPath)
On Error Goto 0
**************************************

When logged on as administrator the script works perfectly. I then applied it as a logon script to one of our special accounts. The script fails due to the account not having the correct permisions. I then set it to run as a startup script to each of our computers. It fails again this time at
Line: 9
Char: 1
Error: 0x080005000
Code: 80005000
Source: Null

Any ideas as to why I am having difficulties running this script.

Our network is a Windows 2003 AD Multysite Domain running 500 Windows XP work stations.

Sponsored Links
Register or log in to remove.
Tom's Hardware > Forum > Windows XP > Configuration & Customize > Add a Domain user to Local Admin Group via vb script
Go to:

There are 698 identified and unidentified users. To see the list of identified users, Click here.

Sponsored links
  • Ask the community now
  • Publish
Ad
They won a badge
Join us in greeting them