Create AD User Remotely

Welcome Forums General PowerShell Q&A Create AD User Remotely

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 7 years ago.

  • Author
  • #6311

    Points: 0
    Rank: Member

    by HighFiv3 at 2013-03-27 06:58:07

    Hi Guy's ,

    i want to Create AD User Remotely in my Domain.
    The script will be running on my Desktopcomputer not on the Server.

    At the moment i have one Problem. I have no idea to move the AD User into a Group. How i can do this without Import the AD Module?
    This my code:
    $usersOU = [ADSI] "LDAP://cn=users,dc=domain,dc=TLD"
    $newUser = $usersOU.Create("user","cn=$Name")
    #$newUser = $usersOU.Create("user","cn=$kuerzel")
    $newUser.put("givenname", "$Vorname")
    $newUser.put("sn", "$Nachname")
    $newUser.Put("displayName","$Vorname" + " " + "$Nachname")
    $newUser.Put("sAMAccountName", $kuerzel)
    $newUser.Put("userPrincipalName", "$upn")

    $newUser.psbase.InvokeSet("AccountDisabled", $false)

    by coderaven at 2013-03-27 07:42:33

    Using ADSI, to add a user to a group you need to connect to the group and call the add function there. See one of Don's articles here

    You may want to look into remoting or the PowerShell Web Access to get around using ADSI.

    by HighFiv3 at 2013-03-27 08:21:37

    I have not fount a Memberof variable with my ADSI-Editor.. my DC is a 2008R2 is this maybe the problem?


    by coderaven at 2013-03-28 07:07:23

    The memberof is not a variable of the ADSI user. You will see the Properties though.


    This article from Richard Siddaway explains it better.

The topic ‘Create AD User Remotely’ is closed to new replies.