VBScript help

Pantlegz

Diamond Member
Jun 6, 2007
4,627
4
81
I've been trying to make a start up script, that's ran once or checks to see if a domain account is added to the local admin group and if not adds it. I've tried a few things I found Googleing but didn't have any luck getting it to work. Anyone feel like helping me out? Or pointing me in the right direction? TIA

Here's what I have that doesn't work - I get access denied error code 8007005 source active directory.
Code:
strComputer = "localhost"
strUser = "localadmin"
strPassword = "password"

Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators")
Set objUser = GetObject("WinNT://domain/username")
objGroup.Add(objUser.ADsPath)
 
Last edited: