Bulk AD creation


Import-Module ActiveDirectory
Import-Csv “C:\Bulk\TTT.csv” | ForEach-Object {
$UserPrincipalName = $_.”SamAccountName” + “@test.com”
New-ADUser -Name $_.Name `
-Path $_.”Parent OU” `
-SamAccountName $_.”samAccountName” `
-UserPrincipalName $UserPrincipalName `
-GivenName $_.GivenName `
-SurName $_.sn `
-displayName $_.displayName `
-AccountPassword (ConvertTo-SecureString “Password@123$” -AsPlainText -Force) `
-ChangePasswordAtLogon $true `
-Enabled $true
}

Advertisements

User Attributes – Inside Active Directory


http://www.kouti.com/tables/userattributes.htm

Import-module activedirectory
Get-Aduser -Filter * -Searchbase "OU=testou,DC=mydomain,DC=com" -properties * | select name, samaccountname | export-csv c:\testou_user_export.csv

 

%d bloggers like this: