Script to quickly create a pastable list of AD users in Powershell.
I might rewrite this in powershell at some point, but due to my familiarity with python, I tossed this together to create a pastable list of AD users for a collaboration lab environment spin up. Hopefully this saves someone time.
#!/usr/bin/python3
list = ["John Doe", "Jane Doe"]
for fullName in list:
nameList = fullName.split(" ")
firstName = nameList[0]
lastName = nameList[1]
print("$Attributes = @{")
print(" Enabled = $true")
print(" ChangePasswordAtLogon = $false")
print(" PasswordNeverExpires = $true")
print(" UserPrincipalName = \"" + lastName.lower() + firstName[0].lower() + "@join.com\"")
print(" Name = \"" + lastName.lower() + firstName[0].lower() + "\"")
print(" GivenName = \"" + firstName + "\"")
print(" Surname = \"" + lastName + "\"")
print(" DisplayName = \"" + fullName + "\"")
print(" Office = \"Remote\"")
print(" Company = \"Company\"")
print(" Department = \"Support\"")
print(" Title = \"Test User\"")
print(" City = \"New York\"")
print(" State = \"New York\"")
print(" AccountPassword = \"CHANGEME\" | ConvertTo-SecureString -AsPlainText -Force")
print("}")
print("New-ADUser @Attributes")
print("Set-ADUser -Identity " + lastName.lower() + firstName[0].lower() + " -Add @{\"msRTCSIP-PrimaryUserAddress\" =\"sip:" + lastName.lower() + firstName[0].lower() + "@join.com\"}")
print("")