plz help .. What the error in this code adding domain user
hi i wrote this code but it is not work plz how i correct hem
i want to add domain user to administrators local group :
user name : "zzb"
pass word : "123"
domain : "toto.com"
Const ADS_SECURE_AUTHENTICATION = 1
strComputer = "computer1"
Set oDSO = GetObject("WinNT:")
Set oComputer = oDSO.OpenDSObject("WinNT://" & strComputer _
, "Administrator", "semsem", ADS_SECURE_AUTHENTICATION)
Set colAccounts = GetObject("WinNT://" & strComputer & ",computer")
Set objUser = oComputer.Create("user", "zzb")
objUser.SetPassword "123"
objUser.SetInfo
Set objGroup = GetObject("WinNT://" & strComputer & "/administrators,group")
Set objUser = GetObject("WinNT://toto.com/zzb,user")
Set objUser = GetObject("WinNT://" & strComputer & "/zzb,user")
objGroup.Add (objUser.ADsPath)
objUser.SetInfo
any help plz
Re: plz help .. What the error in this code adding domain user
What happens when you run the code? What errors do you get?
Does you account have permissions to add domain users to the admin group?
Re: plz help .. What the error in this code adding domain user
I use this script to add a local admin
VB Code:
strComputer = "COMPUTERNAME"
Set objGroup = Getobject("WinNT://" & strComputer & "/Administrators")
objGroup.add ("WinNT://YOURDOMAIN/USERNAME)
'objGroup.remove ("WinNT://YOURDOMAIN/USERANME") '<--- removes user from local admin group