by HighFiv3 at 2013-03-27 06:58:07
Hi Guy’s ,by coderaven at 2013-03-27 07:42:33
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.Put("ScriptPath","logon_ip.cmd")
$newUser.SetInfo()
$newUser.psbase.InvokeSet("AccountDisabled", $false)
$newUser.psbase.invoke("SetPassword","12345678")
$newUser.CommitChanges()
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 hereby HighFiv3 at 2013-03-27 08:21:37
You may want to look into remoting or the PowerShell Web Access to get around using ADSI.
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
Greetz
The memberof is not a variable of the ADSI user. You will see the Properties though.$User.Properties["memberof"]
This article from Richard Siddaway explains it better.