Last active
April 15, 2023 17:53
-
-
Save liamkeegan/cff73c372d511df6d30e127ad64f3fa1 to your computer and use it in GitHub Desktop.
Create bulk AD accounts
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
$userdomain = "http://mydomain.com" | |
$organizationalunitpath = “ou=Politicians,ou=users,ou=company,dc=mydomain,dc=com” | |
$politicians = @( | |
("John","Adams"), | |
("Chester","Arthur"), | |
("Joe","Biden" ), | |
("James","Buchanan"), | |
("Martin","Buren"), | |
("George","Bush"), | |
("Jimmy","Carter"), | |
("Grover","Cleveland"), | |
("Bill","Clinton"), | |
("Calvin","Coolidge"), | |
("Dwight","Eisenhower"), | |
("Millard","Fillmore"), | |
("Gerald","Ford"), | |
("James","Garfield"), | |
("Ulysses","Grant"), | |
("Warren","Harding"), | |
("William","Harrison"), | |
("Benjamin","Harrison"), | |
("Rutherford","Hayes"), | |
("Herbert","Hoover"), | |
("Andrew","Jackson"), | |
("Thomas","Jefferson"), | |
("Lyndon","Johnson"), | |
("Andrew","Johnson"), | |
("John","Kennedy"), | |
("Abraham","Lincoln"), | |
("James","Madison"), | |
("William","McKinley"), | |
("James","Monroe"), | |
("Richard","Nixon"), | |
("Barack","Obama"), | |
("Franklin","Pierce"), | |
("James","Polk"), | |
("Ronald","Reagan"), | |
("Franklin","Roosevelt"), | |
("Theodore","Roosevelt"), | |
("William","Taft"), | |
("Zachary","Taylor"), | |
("Harry","Truman"), | |
("Donald","Trump"), | |
("John","Tyler"), | |
("George","Washington"), | |
("Woodrow","Wilson"), | |
("Aaron","Burr"), | |
("Adlai","Stevenson"), | |
("Al","Gore" ), | |
("Alben","Barkley"), | |
("Charles","Curtis"), | |
("Charles","Dawes"), | |
("Charles","Fairbanks"), | |
("Dan","Quayle"), | |
("Daniel","Tompkins"), | |
("Dick","Cheney"), | |
("Elbridge","Gerry"), | |
("Garret","Hobart"), | |
("George","Clinton"), | |
("George","Dallas"), | |
("Hannibal","Hamlin"), | |
("Henry","Wallace"), | |
("Henry","Wilson"), | |
("Hubert","Humphrey"), | |
("James","Sherman"), | |
("John","Breckinridge"), | |
("John","Calhoun"), | |
("John","Garner"), | |
("Kamala","Harris"), | |
("Levi","Morton"), | |
("Mike","Pence"), | |
("Nelson","Rockefeller"), | |
("Richard","Johnson"), | |
("Schuyler","Colfax"), | |
("Spiro","Agnew"), | |
("Thomas","Hendricks"), | |
("Thomas","Marshall"), | |
("Walter","Mondale"), | |
("William","King"), | |
("William","Wheeler") | |
) | |
IPMO *active* | |
foreach ($politician in $politicians){ | |
$firstname = $politician[0] | |
$lastname = $politician[1] | |
$username = "$firstname.$lastname" | |
$userprincipalname = "$username@$userdomain" | |
Write-host "Creating user account for $username" | |
New-ADUser -Name $username -UserPrincipalName $userprincipalname -GivenName $firstname -Surname $lastname ` | |
-Path $organizationalunitpath -Enabled $true -PasswordNotRequired $true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment