Quick Support

Für den Fernsupport von nicht verwalteten Geräten verwenden wir die sichere und schnelle Support-Software von AnyDesk.

Sie können unseren angepassten Client für Windows, MacOS und Linux unten herunterladen.

Windows Quicksupport
MacOS Quicksupport
Linux 64-Bit Quicksupport
Skip to content

Active Directory How to bulk create demo user

I’m right now preparing a lab environment and need some ad account for represent user of different departments.
As I was not able to find something in google which does create the users in the way I like, I decided to write up something in my own.

As it is maybe useful to some of you guys, here it is 🙂

#Globalconfig
$password = "S3cr3tP@ssw0rd!"
$departments = @("Sales", "Helpdesk", "Engineers", "User", "Manager", "Admin", "Test", "User")
$OrganisationUnit = "OU=GlobalUser,dc=adnlab,dc=local"

#userconfig
$UserOrganization = "ADNLab"
$UserUPNsuffix = "@adnlab.local"
$UserEmailsuffix= "@adnlab.local"
$UserChangePasswordatLogon = $false
$UserCity = "Bochum"
$UserPostalCode = "44688"
$UserState = "NRW"
$UserStreetAddress = "Josef-Haumann-Str. 10"
$UserCountry = "DE"
$UserCompany = "ADNLab"
$UserPasswordNeverExpires = $true

$securepassword = ConvertTo-SecureString -AsPlainText $password -Force

foreach ($usertype in $departments) {
	1..7 | foreach { 
		New-ADUser -Name "$usertype $_"-SamAccountName $usertype$_ -UserPrincipalName $usertype$_$UserUPNsuffix -Organization $UserOrganization -Department $usertype -Surname $_ -EmailAddress $usertype$_$UserEmailsuffix -ChangePasswordAtLogon $UserChangePasswordatLogon -City $UserCity -PostalCode $UserPostalCode -State $UserState -DisplayName "$usertype $_" -Company $UserCompany -StreetAddress $UserStreetAddress -Country $UserCountry -GivenName $usertype -PasswordNeverExpires $UserPasswordNeverExpires -AccountPassword $securepassword -Enabled $true -Title $usertype -Path $OrganisationUnit
		}
}

Dieser Beitrag hat 0 Kommentare

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

ERROR: si-captcha.php plugin: securimage.php not found.

An den Anfang scrollen