Active Directory Users
hi all, im relatively new powershell scripting , im hoping learn alot here!! :)
okay so, have base script adding user in ad, cannot work out why fails life of me
$class = "user"
$strusername = "cn=john doe"
$objadsi = [adsi]"ldap://ou=[ou],dc=[domain],dc=[domain],dc=[domain]
$objuser = $objadsi.create($class,$strusername)
$objuser.put("samaccountname", "jdoe")
$objuser.setinfo()
when use it fails, learnt of tutorial found on internet.
any , appreciated.
the error message doesn't make sense me. unless there non-display character in string "jdoe".
oh wait, see. adspath in first statement lacks trailing quote character. try:
$objadsi = [adsi]"ldap://ou=[ou],dc=[domain],dc=[domain],dc=[domain]"
added final quote. problem?
richard mueller - mvp directory services
Windows Server > Windows PowerShell
Comments
Post a Comment