scripts/AD_AIO.ps1 aktualisiert
This commit is contained in:
@@ -196,6 +196,8 @@ function Create-User {
|
||||
$password = $masterPassword
|
||||
}
|
||||
|
||||
$groupOU = $masterGroupOUComboBox.SelectedItem
|
||||
|
||||
# Überprüfen, ob notwendige Felder ausgefüllt sind
|
||||
if (-not $firstName -or -not $lastName) {
|
||||
$missingField = if (-not $firstName) { "Vorname" } elseif (-not $lastName) { "Nachname" }
|
||||
@@ -236,16 +238,17 @@ function Create-User {
|
||||
}
|
||||
else {
|
||||
# Erfolgsnachricht für vorhandenen Benutzer
|
||||
$outputTextBox.SelectionColor = 'Green'
|
||||
$outputTextBox.SelectionColor = 'RED'
|
||||
$outputTextBox.AppendText("Benutzer $username existiert bereits.`r`n")
|
||||
$outputTextBox.AppendText("Fehlerdetails: $_`r`n")
|
||||
}
|
||||
|
||||
# Gruppenzuordnung durchführen, auch wenn der Benutzer schon existiert
|
||||
if ($globalGroup) {
|
||||
# Gruppen-OU immer auf die Master-OU setzen
|
||||
$groupOU = $masterGroupOUComboBox.SelectedItem
|
||||
try {
|
||||
# Überprüfen, ob die Gruppe existiert
|
||||
$groupOU = $masterGroupOUComboBox.SelectedItem
|
||||
$group = Get-ADGroup -Filter { Name -eq $globalGroup }
|
||||
try {
|
||||
# Gruppe erstellen, falls sie nicht existiert
|
||||
|
||||
Reference in New Issue
Block a user