|
RE: Create new user account All I've been able to come up with so far is this. I haven't been able to set
the password yet.
$ou=[ADSI]"LDAP://cn=Users,dc=test,dc=com"
$user = $ou.Create("user","cn=User1")
$user.Put("sAMAccountName", "User1")
$user.SetInfo()
$User.put("useraccountcontrol",$User.useraccountcontrol.value -band (-bnot 2))
$user.SetInfo()
$Group=[ADSI]"LDAP://cn=dnsadmins,cn=Users,dc=test,dc=com"
$Group.PutEx(3, "member", @("cn=User1,cn=Users,dc=test,dc=com"))
$Group.SetInfo()
---
Jim Holbach
"krukinews@gmail.com" wrote:
> Hi,
>
> I'm trying to create new user in AD.
>
> $ou=[ADSI]"LDAP://ou=myUsers,dc=test,dc=com"
> $user = $ou.Create("user","cn="User1")
> $user.Put("sAMAccountName", "User1")
> $user.SetInfo()
>
> But this only creates disabled user (without password).
>
> How can I set password and enable this user?
> Also how can I add user to some group?
>
> Krunoslav
>
> |