chore: add setup users
This commit is contained in:
30
SetupUsers.ps1
Normal file
30
SetupUsers.ps1
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
param(
|
||||||
|
[string]$Domain,
|
||||||
|
[string]$OU
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
$Users = Import-Csv .\Users.csv
|
||||||
|
|
||||||
|
ForEach ($User in $Users) {
|
||||||
|
$DisplayName = $User.DisplayName
|
||||||
|
$FirstName = $User.FirstName
|
||||||
|
$Surname = $User.Surname
|
||||||
|
$SurnameInitial = $User.Surname[0]
|
||||||
|
|
||||||
|
Write-Host $DisplayName "$FirstName$SurnameInitial@$Domain"
|
||||||
|
|
||||||
|
Write-Host "Creating sample users..." -ForegroundColor Cyan
|
||||||
|
$UserPassword = ConvertTo-SecureString "P@ssw0rd123!" -AsPlainText -Force
|
||||||
|
|
||||||
|
New-ADUser -Name "$DisplayName" -GivenName "$FirstName" -Surname "$Surname" `
|
||||||
|
-SamAccountName "$FirstName$SurnameInitial" -UserPrincipalName "$FirstName$SurnameInitial@$Domain" `
|
||||||
|
-AccountPassword $UserPassword -Enabled $true `
|
||||||
|
-Path "$OU" -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
|
Set-ADUser -Identity "$FirstName$SurnameInitial" -EmailAddress "$FirstName$SurnameInitial@$Domain"
|
||||||
|
Set-ADUser -Identity "$FirstName$SurnameInitial" -Add @{proxyAddresses="SMTP:$FirstName$SurnameInitial@$Domain"}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
21
Users.csv
Normal file
21
Users.csv
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
DisplayName,FirstName,Surname
|
||||||
|
Adele Vance,Adele,Vance
|
||||||
|
Alex Wilber,Alex,Wilber
|
||||||
|
Allan Deyoung,Allan,Deyoung
|
||||||
|
Christie Cline,Christie,Cline
|
||||||
|
Debra Berger,Debra,Berger
|
||||||
|
Diego Siciliani,Diego,Siciliani
|
||||||
|
Grady Archie,Grady,Archie
|
||||||
|
Irvin Sayers,Irvin,Sayers
|
||||||
|
Isaiah Langer,Isaiah,Langer
|
||||||
|
Johanna Lorenz,Johanna,Lorenz
|
||||||
|
Joni Sherman,Joni,Sherman
|
||||||
|
Lee Gu,Lee,Gu
|
||||||
|
Lidia Holloway,Lidia,Holloway
|
||||||
|
Lynne Robbins,Lynne,Robbins
|
||||||
|
Megan Bowen,Megan,Bowen
|
||||||
|
Miriam Graham,Miriam,Graham
|
||||||
|
MOD Administrator,MOD,Administrator
|
||||||
|
Nestor Wilke,Nestor,Wilke
|
||||||
|
Patti Fernandez,Patti,Fernandez
|
||||||
|
Pradeep Gupta,Pradeep,Gupta
|
|
Reference in New Issue
Block a user