ADAM / ADSI User Creation

This topic contains 8 replies, has 2 voices, and was last updated by Profile photo of Windows LiveUser93 Windows LiveUser93 2 years, 2 months ago.

  • Author
    Posts
  • #18752
    Profile photo of Windows LiveUser93
    Windows LiveUser93
    Participant

    Hi

    I Was looking for some assistance with creation of a GroupOfNames class user that is created within ADAM of Active Directory.

    I Have the following but it errors out and I think it has to do with the ADAM part of this need. Any assistance would be great.

    This is what I have that is NOT working and was looking where to go from here.

    $dom=[ADSI]"LDAP://OU=Users,OU=dev,OU=tdev,dc=acme,dc=com"
    $obj = $dom.Create('GroupOfNames', 'CN=ASmith')
    $obj.SetInfo()

  • #18759
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

    What errors do you receive when you run that code?

  • #18769
    Profile photo of Windows LiveUser93
    Windows LiveUser93
    Participant

    Hi
    Thank you for responding. The following is the error. The GroupOfNames is a class that I need to create this in.

    Exception calling "SetInfo" with "0" argument(s): "The requested operation did

    not satisfy one or more constraints associated with the class of the object.

    "

    At line:1 char:1

    + $obj.SetInfo()

    + ~~~~~~~~~~~~~~

    + CategoryInfo : NotSpecified: (:) [], MethodInvocationException

    + FullyQualifiedErrorId : CatchFromBaseAdapterMethodInvokeTI

  • #18773
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

    According to http://msdn.microsoft.com/en-ca/library/cc221862.aspx , it looks like this class must contain a "member" attribute. You would need to populate this attribute before calling SetInfo().

  • #18774
    Profile photo of Windows LiveUser93
    Windows LiveUser93
    Participant

    I thought that this line represented that?

    $obj = $dom.Create('GroupOfNames', 'CN=ASmith')

  • #18776
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

    Nope. In that line, you're creating a GroupOfNames object that is itself called 'ASmith', rather than GroupOfNames object that contains ASmith as a member.

  • #18777
    Profile photo of Windows LiveUser93
    Windows LiveUser93
    Participant

    Aaaah so how would you create a user in ADAM within an ou like the following. the view I am representing is within adsiedit and is currently how we add a user of this type.

    name class Distingguishedname

    cn=fdoe groupofnames OU=Users,OU=dev,OU=tdev,dc=acme,dc=com

  • #18778
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

    Well, a user and a groupOfNames are different things. If you want to create a groupOfNames object, you're already on the right track, but it needs to contain at least one member. Something along these lines:

    $ou = [ADSI]'LDAP://OU=Users,OU=dev,OU=tdev,dc=acme,dc=com'
    $obj = $ou.Create('GroupOfNames', 'CN=fdoe')
    $obj.member = 'CN=ASmith,OU=Users,OU=dev,OU=tdev,dc=acme,dc=com'
    $obj.SetInfo()
    

    I don't know if that code will work as-is; I can't test it at the moment. Working with ADSI via PowerShell can be a bit of a headache.

  • #18779
    Profile photo of Windows LiveUser93
    Windows LiveUser93
    Participant

    Thank you very much.
    I am in no way even close to being a programmer and sometimes find it very difficult to bridge the programming terms / process with being a system admin.
    I will try it out and respond back. This is a ldap connection for Teradata users and up to now it is a manual process. I want to script it so I can hand it off to our access control team.

    Thanks again.

You must be logged in to reply to this topic.