|
-
Jan 24th, 2006, 03:58 AM
#1
Thread Starter
Member
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
-
Jan 24th, 2006, 06:54 AM
#2
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?
-
Jul 12th, 2006, 06:37 AM
#3
Addicted Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|