create user etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
create user etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster

Active Directory Tasks by using Powershell

Create OU
$strCL="organizationalUnit"
$strOUName="ou=TestOU"
$objADSI=[ADSI]"LDAP://dc=fabrikam,dc=com"
$objOU=$objADSI.create($strCL,$strOUName)
$objOU.setinfo()

Create User
$strCL="User"
$strName="Cn=Erkan"
$objADSI=[ADSI]"LDAP://ou=TestOU,dc=fabrikam,dc=com"
$objUser=$objADSI.create($strCL,$strName)
$$objUser.Put("sAMAccountName","Erkan")
$objUser.setinfo()

Modify User Properties

$objUser=[ADSI]"LDAP://cn=Erkan,ou=TestOU,dc=fabrikam,dc=com"
$objUser.put("sAMAccountName","Erkan")
$objUser.put("givenName","Sezgin")
$objUser.put("DisplayName","Erkan Sezgin")
$objUser.put("telephoneNumber","216-111-1111")
$objUser.put("mail","erkan.sezgin@fabrikam.com")
$objUser.setinfo()

Other Attributes;
wwwHomePage,description,streetAddress,postOfficeBox,l,st,postalcode,CountryCode
homeDirectory,homeDrive,profilePath,scriptPath,homePhone,title

put what you want,but dont forget the $setinfo() method at the end.

Powershell-Creating Local User

how to create a local user by using Powershell

$user="powershell"
$password="12345678"

#uses ADSI types and WinNT provider

$objou=[ADSI]"WinNT://erkan_sezgin"
$objuser=$objou.create("user",$user)
$objuser.setpassword($password)
$objuser.setinfo()
$objuser.description="test user"
$objuser.setinfo()