scripts/AD_GROUPS_CREATE.ps1 aktualisiert

This commit is contained in:
2024-11-07 09:41:22 +01:00
parent 44486d05a8
commit b65958f503

View File

@@ -31,6 +31,7 @@ $typColumn = New-Object System.Windows.Forms.DataGridViewComboBoxColumn
$typColumn.HeaderText = "Typ"
$typColumn.Items.Add("GG")
$typColumn.Items.Add("DL")
$typColumn.Items.Add("DL_OS")
$dataGridView.Columns.RemoveAt(0)
$dataGridView.Columns.Insert(0, $typColumn)
# Breite der Typ-Spalte setzen
@@ -78,6 +79,8 @@ $okButton.Add_Click({
# Präfix vor den Gruppennamen setzen, basierend auf dem Typ
if ($groupType -eq "GG") {
$groupName = "GG_" + $groupName # Für globale Gruppen "GG_" voranstellen
} elseif ($groupType -eq "DL_OS") {
$groupName = "DL_" + $groupName # Für globale Gruppen "DL_OS" voranstellen
} elseif ($groupType -eq "DL") {
$groupName = "DL_" + $groupName # Für DomainLocal Gruppen "DL_" voranstellen
}
@@ -97,6 +100,19 @@ $okButton.Add_Click({
$outputTextBox.SelectionColor = 'Green'
$outputTextBox.AppendText("Globale Gruppe '$groupName' existiert bereits.`r`n")
}
} elseif ($groupType -eq "DL_OS") {
# DomainLocal Gruppen ohne Suffix erstellen
if (-not $group) {
New-ADGroup -Name $domainLocalGroupName `
-GroupScope DomainLocal `
-Path $groupOU `
-Description "DomainLocal Gruppe für $domainLocalGroupName"
$outputTextBox.SelectionColor = 'Green'
$outputTextBox.AppendText("DomainLocal Gruppe '$domainLocalGroupName' wurde erfolgreich erstellt.`r`n")
} else {
$outputTextBox.SelectionColor = 'Green'
$outputTextBox.AppendText("DomainLocal Gruppe '$domainLocalGroupName' existiert bereits.`r`n")
}
} elseif ($groupType -eq "DL") {
# DomainLocal Gruppen mit Suffixen erstellen
$suffixes = "_FA", "_RW", "_RX", "_RO"