Created
April 29, 2016 14:43
-
-
Save terrytrent/a675f1cc7d6fbad28ae23e6e1ef6d05d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Reflection.Assembly]::LoadWithPartialName("System.Web") | |
$Credentials=$(get-credentials) | |
$RandomPassword=[System.Web.Security.Membership]::GeneratePassword(10,0) | |
$domainLocal='ad.fattswindstormelec.com' | |
$domainPublic='fattswindstormelec.com' | |
$UserFirst='Poopy' | |
$UserLast='McButthole' | |
$Name="$UserFirst $UserLast" | |
$SamAccountName="$($UserFirst.substring(0,1))$($UserLast.substring(0,7))" | |
$UserPrincipalName="$SamAccountName@$domainLocal" | |
$Email="$UserFirst.$UserLast@$domainpublic" | |
$OrganizationalUnit='OU=Office, OU=fattswindstorm Electrical,DC=fattswindstormelec,DC=com' | |
New-ADUser -Name $Name -DisplayName $Name -EmailAddress $Email -Enabled $true -GivenName $UserFirst -Surname $UserLast -SamAccountName $SamAccountName -UserPrincipalName $UserPrincipalName -AccountPassword $($RandomPassword | ConvertTo-SecureString -Force -AsPlainText) -ChangePasswordAtLogon $true -Credential $Credentials |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment