2021-01-23 15:04:42 +00:00
|
|
|
#Requires -Modules 'ActiveDirectory'
|
|
|
|
Param(
|
|
|
|
[Parameter(Mandatory)]
|
|
|
|
[hashtable]$Parameter
|
|
|
|
)
|
|
|
|
|
2021-01-27 11:12:44 +00:00
|
|
|
# Only executed on primary or standalone Domain Controller
|
|
|
|
If (@('primary','standalone') -contains $Parameter['deployment.type']) {
|
2021-01-23 15:04:42 +00:00
|
|
|
$GetContentSplat = @{
|
|
|
|
Path = "$($PSScriptRoot)\$($MyInvocation.MyCommand)".Replace('.ps1', ".csv")
|
|
|
|
}
|
|
|
|
$CSVImport = (Get-Content @GetContentSplat) | ConvertFrom-Csv
|
|
|
|
|
|
|
|
ForEach ($Group in $CSVImport) {
|
|
|
|
$NewADGroupSplat = @{
|
|
|
|
Name = ($Group.DistinguishedName -split ',', 2)[0].Substring(3)
|
|
|
|
Path = ($Group.DistinguishedName -split ',', 2)[1] + ',DC=' + $Parameter['addsconfig.domainname'].Replace('.', ',DC=')
|
|
|
|
Description = $Group.Description
|
|
|
|
GroupCategory = 'Security'
|
|
|
|
GroupScope = 'Global'
|
|
|
|
ErrorAction = 'SilentlyContinue'
|
|
|
|
}
|
|
|
|
New-ADGroup @NewADGroupSplat
|
|
|
|
}
|
|
|
|
}
|