Met onderstaande code kun je de gebruikers voor poliforma uit het boek netwerkbeheer met Smets inlezen. Wijzig de variabele indien nodig in jouw eigen domeinnaam. Zorg dat het pad bestaan en de OU’s bestaan.

Import-Module ActiveDirectory

#Domain name
$Domain = "FormaPoli"

# Deel 1, Hoofdstuk 9 - Eerste Account Madelief Smets aanmaken in OU Directie
New-ADUser -Name "Madelief Smets" -GivenName "Madelief" -Surname "Smets" -SamAccountName "Mad_Sme" -UserPrincipalName "Mad_Sme@$Domain.local" -Description "Directeur" -title "Directeur" -Office "B02" -OfficePhone "4101" -Department "Directie" -Company "$Domain BV" -City "Budel" -HomeDirectory "\\PFSV1\UserFolders\Mad_Sme" -HomeDrive "z:" -Organization "$Domain BV" -ProfilePath "\\PFSV1\UserProfiles\Mad_Sme" -Path "OU=Directie,OU=PFAfdelingen,DC=$Domain,DC=local" -AccountPassword (ConvertTo-SecureString -AsPlainText "Kleinkind1" -Force) -Enabled $true -PasswordNeverExpires $false -ChangePasswordAtLogon $true
New-Item -path \\PFSV1\UserFolders\Mad_Sme -ItemType Directory -force | Out-Null

# Deel 1, Hoofdstuk 9 -  Accounts aanmaken in OU Directie
New-ADUser -Name "Jolanda Brands" -GivenName "Jolanda" -Surname "Brands" -SamAccountName "Jol_Bra" -UserPrincipalName "Jol_Bra@$Domain.local" -Description "Adjunct Automatisering" -title "Adjunct-directeur" -Office "B20" -OfficePhone "4111" -Company "$Domain BV" -City "Budel" -HomeDirectory "\\PFSV1\UserFolders\Jol_Bra" -HomeDrive "z:" -Organization "$Domain BV" -ProfilePath "\\PFSV1\UserProfiles\Jol_Bra"  -Path "OU=Directie,OU=PFAfdelingen,DC=$Domain,DC=local" -AccountPassword (ConvertTo-SecureString -AsPlainText "Jol&Bra" -Force) -Enabled $true -PasswordNeverExpires $true 
New-Item -path \\PFSV1\UserFolders\Jol_Bra -ItemType Directory -force | Out-Null

New-ADUser -Name "Teus de Jong" -GivenName "Teus" -Surname "de Jong" -SamAccountName "Teu_Djo" -UserPrincipalName "Teu_Djo@$Domain.local" -Description "Adjunct Administratie" -title "Adjunct-directeur" -Office "B09" -OfficePhone "4087" -Company "$Domain BV" -City "Budel" -HomeDirectory "\\PFSV1\UserFolders\Teu_DJo" -HomeDrive "z:" -Organization "$Domain BV" -ProfilePath "\\PFSV1\UserProfiles\Teu_DJo"  -Path "OU=Directie,OU=PFAfdelingen,DC=$Domain,DC=local" -AccountPassword (ConvertTo-SecureString -AsPlainText "Teu&Djoe" -Force) -Enabled $true -PasswordNeverExpires $true
New-Item -path \\PFSV1\UserFolders\Teu_Djo -ItemType Directory -force | Out-Null

New-ADUser -Name "Henk Pell" -GivenName "Henk" -Surname "Pell" -SamAccountName "Hen_Pel" -UserPrincipalName "Hen_Pel@$Domain.local" -Description "Adjunct Verkoop" -title "Adjunct-directeur" -Office "B17" -OfficePhone "4131" -Company "$Domain BV" -City "Budel" -HomeDirectory "\\PFSV1\UserFolders\Hen_Pel" -HomeDrive "z:" -Organization "$Domain BV" -ProfilePath "\\PFSV1\UserProfiles\Hen_Pel"  -Path "OU=Directie,OU=PFAfdelingen,DC=$Domain,DC=local" -AccountPassword (ConvertTo-SecureString -AsPlainText "Hen&Pel" -Force) -Enabled $true -PasswordNeverExpires $true
New-Item -path \\PFSV1\UserFolders\Hen_Pel -ItemType Directory -force | Out-Null

New-ADUser -Name "Dick Brinkman" -GivenName "Dick" -Surname "Brinkman" -SamAccountName "Dic_Bri" -UserPrincipalName "Dic_Bri@$Domain.local" -Description "Adjunct Productie" -title "Adjunct-directeur" -Office "B05" -OfficePhone "4612" -Company "$Domain BV" -City "Budel" -HomeDirectory "\\PFSV1\UserFolders\Dic_Bri" -HomeDrive "z:" -Organization "$Domain BV" -ProfilePath "\\PFSV1\UserProfiles\Dic_Bri"  -Path "OU=Directie,OU=PFAfdelingen,DC=$Domain,DC=local" -AccountPassword (ConvertTo-SecureString -AsPlainText "Dic&Bri" -Force) -Enabled $true -PasswordNeverExpires $true
New-Item -path \\PFSV1\UserFolders\Dic_Bri -ItemType Directory -force | Out-Null

# Deel 1, Hoofdstuk 9 -  Accounts aanmaken in OU Staf
New-ADUser -Name "Danique Voss" -GivenName "Danique" -Surname "Voss" -SamAccountName "Dan_Vos" -UserPrincipalName "Dan_Vos@$Domain.local" -Description "Hoofd Staf" -title "Hoofd" -Office "B03" -OfficePhone "4003" -Company "$Domain BV" -City "Budel" -HomeDirectory "\\PFSV1\UserFolders\Dan_Vos" -HomeDrive "z:" -Organization "$Domain BV" -ProfilePath "\\PFSV1\UserProfiles\Dan_Vos"  -Path "OU=Staf,OU=PFAfdelingen,DC=$Domain,DC=local" -AccountPassword (ConvertTo-SecureString -AsPlainText "Dan&Vos" -Force) -Enabled $true -PasswordNeverExpires $true
New-Item -path \\PFSV1\UserFolders\Dan_Vos -ItemType Directory -force | Out-Null

New-ADUser -Name "Loes Heijnen" -GivenName "Loes" -Surname "Heijnen" -SamAccountName "Loe_Hei" -UserPrincipalName "Loe_Hei@$Domain.local" -Description "Receptioniste/Telefoniste" -title "Medewerker" -Office "B04" -OfficePhone "4001" -Company "$Domain BV" -City "Budel" -HomeDirectory "\\PFSV1\UserFolders\Loe_Hei" -HomeDrive "z:" -Organization "$Domain BV" -ProfilePath "\\PFSV1\UserProfiles\Loe_Hei"  -Path "OU=Staf,OU=PFAfdelingen,DC=$Domain,DC=local" -AccountPassword (ConvertTo-SecureString -AsPlainText "Loe&Hei" -Force) -Enabled $true -PasswordNeverExpires $true
New-Item -path \\PFSV1\UserFolders\Loe_Hei -ItemType Directory -force | Out-Null

# Deel 1, Hoofdstuk 9 -  Accounts aanmaken in OU Verkoop
New-ADUser -Name "Wiel Nouwen" -GivenName "Wiel" -Surname "Nouwen" -SamAccountName "Wie_Nou" -UserPrincipalName "Wie_Nou@$Domain.local" -Description "Account Manager" -title "Medewerker" -Office "B16" -OfficePhone "4077" -Company "$Domain BV" -City "Budel" -HomeDirectory "\\PFSV1\UserFolders\Wie_Nou" -HomeDrive "z:" -Organization "$Domain BV" -ProfilePath "\\PFSV1\UserProfiles\Wie_Nou"  -Path "OU=Verkoop,OU=PFAfdelingen,DC=$Domain,DC=local" -AccountPassword (ConvertTo-SecureString -AsPlainText "Loe&Hei" -Force) -Enabled $true -PasswordNeverExpires $true
New-Item -path \\PFSV1\UserFolders\Wie_Nou -ItemType Directory -force | Out-Null

# Deel 1, Hoofdstuk 9 -  Accounts aanmaken in OU Administratie
New-ADUser -Name "Dirk Bogert" -GivenName "Dirk" -Surname "Bogert" -SamAccountName "Dir_Bog" -UserPrincipalName "Dir_Bog@$Domain.local" -Description "Boekhouder" -title "Medewerker" -Office "B11" -OfficePhone "4142"  -Company "$Domain BV" -City "Budel" -HomeDirectory "\\PFSV1\UserFolders\Dir_Bog" -HomeDrive "z:" -Organization "$Domain BV" -ProfilePath "\\PFSV1\UserProfiles\Dir_Bog" -Path "OU=Administratie,OU=PFAfdelingen,DC=$Domain,DC=local" -AccountPassword (ConvertTo-SecureString -AsPlainText "Dir&Bog" -Force) -Enabled $true -PasswordNeverExpires $true
New-Item -path \\PFSV1\UserFolders\Dir_Bog -ItemType Directory -force | Out-Null

# Deel 1, Hoofdstuk 9 -  Accounts aanmaken in OU Productie
New-ADUser -Name "Karin Visse" -GivenName "Karin" -Surname "Visse" -SamAccountName "Kar_Vis" -UserPrincipalName "Kar_Vis@$Domain.local" -Description "Secretaresse" -title "Medewerker" -Office "B06" -OfficePhone "4206"  -Company "$Domain BV" -City "Budel" -HomeDirectory "\\PFSV1\UserFolders\Kar_Vis" -HomeDrive "z:" -Organization "$Domain BV" -ProfilePath "\\PFSV1\UserProfiles\Kar_Vis" -Path "OU=Productie,OU=PFAfdelingen,DC=$Domain,DC=local" -AccountPassword (ConvertTo-SecureString -AsPlainText "Kar&Vis" -Force) -Enabled $true -PasswordNeverExpires $true
New-Item -path \\PFSV1\UserFolders\Kar_Vis -ItemType Directory -force | Out-Null

New-ADUser -Name "Herman Bommel" -GivenName "Herman" -Surname "Bommel" -SamAccountName "Her_Bom" -UserPrincipalName "Her_Bom@$Domain.local" -Description "Inkoper/Magazijn-beheerder" -title "Medewerker" -Office "W03" -OfficePhone "4199"  -Company "$Domain BV" -City "Budel" -HomeDirectory "\\PFSV1\UserFolders\Her_Bom" -HomeDrive "z:" -Organization "$Domain BV" -ProfilePath "\\PFSV1\UserProfiles\Her_Bom" -Path "OU=Productie,OU=PFAfdelingen,DC=$Domain,DC=local" -AccountPassword (ConvertTo-SecureString -AsPlainText "Her&Bom" -Force) -Enabled $true -PasswordNeverExpires $true
New-Item -path \\PFSV1\UserFolders\Her_Bom -ItemType Directory -force | Out-Null

New-ADUser -Name "Doortje Heijnen" -GivenName "Doortje" -Surname "Heijnen" -SamAccountName "Dor_Hei" -UserPrincipalName "Dor_Hei@$Domain.local" -Description "Productontwikkelaar" -title "Medewerker" -Office "B08" -OfficePhone "4163"  -Company "$Domain BV" -City "Budel" -HomeDirectory "\\PFSV1\UserFolders\Dor_Hei" -HomeDrive "z:" -Organization "$Domain BV" -ProfilePath "\\PFSV1\UserProfiles\Dor_Hei" -Path "OU=Productie,OU=PFAfdelingen,DC=$Domain,DC=local" -AccountPassword (ConvertTo-SecureString -AsPlainText "Dor&Hei" -Force) -Enabled $true -PasswordNeverExpires $true
New-Item -path \\PFSV1\UserFolders\Dor_Hei -ItemType Directory -force | Out-Null

New-ADUser -Name "Peter Carprieux" -GivenName "Peter" -Surname "Carprieux" -SamAccountName "Pet_Car" -UserPrincipalName "Pet_Car@$Domain.local" -Description "Hoofd FabricageBudel" -title "Hoofd" -Office "W01" -OfficePhone "4218"  -Company "$Domain BV" -City "Budel" -HomeDirectory "\\PFSV1\UserFolders\Pet_Car" -HomeDrive "z:" -Organization "$Domain BV" -ProfilePath "\\PFSV1\UserProfiles\Pet_Car" -Path "OU=Productie,OU=PFAfdelingen,DC=$Domain,DC=local" -AccountPassword (ConvertTo-SecureString -AsPlainText "Pet&Car" -Force) -Enabled $true -PasswordNeverExpires $true
New-Item -path \\PFSV1\UserFolders\Pet_Car -ItemType Directory -force | Out-Null

# Deel 1, Hoofdstuk 9 -  Accounts aanmaken in OU Fabricage
New-ADUser -Name "Will Snellen" -GivenName "Will" -Surname "Snellen" -SamAccountName "Wil_Sne" -UserPrincipalName "Wil_Sne@$Domain.local" -Description "Chef Werkplaats" -title "Chef" -Office "W05" -OfficePhone "4200"  -Company "$Domain BV" -City "Budel" -HomeDirectory "\\PFSV1\UserFolders\Wil_Sne" -HomeDrive "z:" -Organization "$Domain BV" -ProfilePath "\\PFSV1\UserProfiles\Wil_Sne" -Path "OU=Fabricage,OU=Productie,OU=PFAfdelingen,DC=$Domain,DC=local" -AccountPassword (ConvertTo-SecureString -AsPlainText "Wil&Sne" -Force) -Enabled $true -PasswordNeverExpires $true
New-Item -path \\PFSV1\UserFolders\Wil_Sne -ItemType Directory -force | Out-Null

New-ADUser -Name "Niels Smets" -GivenName "Niels" -Surname "Smets" -SamAccountName "Nie_Sme" -UserPrincipalName "Nie_Sme@$Domain.local" -Description "Productcontroleur" -title "Medewerker" -Office "W02" -OfficePhone "4251"  -Company "$Domain BV" -City "Budel" -HomeDirectory "\\PFSV1\UserFolders\Nie_Sme" -HomeDrive "z:" -Organization "$Domain BV" -ProfilePath "\\PFSV1\UserProfiles\Nie_Sme" -Path "OU=Fabricage,OU=Productie,OU=PFAfdelingen,DC=$Domain,DC=local" -AccountPassword (ConvertTo-SecureString -AsPlainText "Nie&Sme" -Force) -Enabled $true -PasswordNeverExpires $true
New-Item -path \\PFSV1\UserFolders\Nie_Sme -ItemType Directory -force | Out-Null

New-ADUser -Name "Floris Flipse" -GivenName "Floris" -Surname "Flipse" -SamAccountName "Flo_Fli" -UserPrincipalName "Flo_Fli@$Domain.local" -Description "Chef Onderhoud" -title "Chef" -Office "W06" -OfficePhone "4266"  -Company "$Domain BV" -City "Budel" -HomeDirectory "\\PFSV1\UserFolders\Flo_Fli" -HomeDrive "z:" -Organization "$Domain BV" -ProfilePath "\\PFSV1\UserProfiles\Flo_Fli" -Path "OU=Fabricage,OU=Productie,OU=PFAfdelingen,DC=$Domain,DC=local" -AccountPassword (ConvertTo-SecureString -AsPlainText "Flo&Fli" -Force) -Enabled $true -PasswordNeverExpires $true
New-Item -path \\PFSV1\UserFolders\Flo_Fli -ItemType Directory -force | Out-Null

# Deel 1, Hoofdstuk 9 -  Accounts aanmaken in OU Automatisering
New-ADUser -Name "Fons Willemsen" -GivenName "Fons" -Surname "Willemsen" -SamAccountName "Fon_Wil" -UserPrincipalName "Fon_Wil@$Domain.local" -Description "CNC-programmeur" -title "Medewerker" -Office "B18" -OfficePhone "4208"  -Company "$Domain BV" -City "Budel" -HomeDirectory "\\PFSV1\UserFolders\Fon_Wil" -HomeDrive "z:" -Organization "$Domain BV" -ProfilePath "\\PFSV1\UserProfiles\Fon_Wil" -Path "OU=Automatisering,OU=PFAfdelingen,DC=$Domain,DC=local" -AccountPassword (ConvertTo-SecureString -AsPlainText "Fon&Wil" -Force) -Enabled $true -PasswordNeverExpires $true
New-Item -path \\PFSV1\UserFolders\Fon_Wil -ItemType Directory -force | Out-Null

Write-Host "Done."