Results 1 to 3 of 3

Thread: plz help .. What the error in this code adding domain user

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2004
    Posts
    46

    Question 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
    haker7_8

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    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?

  3. #3
    Addicted Member
    Join Date
    Jun 2006
    Posts
    250

    Re: plz help .. What the error in this code adding domain user

    I use this script to add a local admin

    VB Code:
    1. strComputer = "COMPUTERNAME"
    2. Set objGroup = Getobject("WinNT://" & strComputer & "/Administrators")
    3. objGroup.add ("WinNT://YOURDOMAIN/USERNAME)
    4. '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
  •  



Click Here to Expand Forum to Full Width