scripts/AD_AIO.ps1 aktualisiert

This commit is contained in:
2024-11-11 14:31:10 +01:00
parent 5784c733e6
commit d31cc4fdf3

View File

@@ -318,6 +318,7 @@ function Create-User {
}
}
}
[System.Windows.Forms.MessageBox]::Show("Vorgang abgeschlossen.")
})
# Event-Handler für den Beenden-Button hinzufügen
@@ -335,7 +336,7 @@ function Create-User {
}
# Formular anzeigen
$form.Show()
$form.ShowDialog()
}
# Funktion, die beim Klick auf "Create Groups" ausgeführt wird
@@ -441,12 +442,13 @@ function Create-Groups {
$outputTextBox.SelectionColor = 'Green'
$outputTextBox.AppendText("Globale Gruppe '$groupName' wurde erfolgreich erstellt.`r`n")
} else {
$outputTextBox.SelectionColor = 'Green'
$outputTextBox.SelectionColor = 'Orange'
$outputTextBox.AppendText("Globale Gruppe '$groupName' existiert bereits.`r`n")
}
} elseif ($groupType -eq "DL_OS") {
# DomainLocal Gruppen ohne Suffix erstellen
$domainLocalGroupName = "$groupName"
$group = Get-ADGroup -Filter { Name -eq $domainLocalGroupName }
if (-not $group) {
New-ADGroup -Name $domainLocalGroupName `
-GroupScope DomainLocal `
@@ -455,7 +457,7 @@ function Create-Groups {
$outputTextBox.SelectionColor = 'Green'
$outputTextBox.AppendText("DomainLocal Gruppe '$domainLocalGroupName' wurde erfolgreich erstellt.`r`n")
} else {
$outputTextBox.SelectionColor = 'Green'
$outputTextBox.SelectionColor = 'Orange'
$outputTextBox.AppendText("DomainLocal Gruppe '$domainLocalGroupName' existiert bereits.`r`n")
}
} elseif ($groupType -eq "DL") {
@@ -472,7 +474,7 @@ function Create-Groups {
$outputTextBox.SelectionColor = 'Green'
$outputTextBox.AppendText("DomainLocal Gruppe '$domainLocalGroupName' wurde erfolgreich erstellt.`r`n")
} else {
$outputTextBox.SelectionColor = 'Green'
$outputTextBox.SelectionColor = 'Orange'
$outputTextBox.AppendText("DomainLocal Gruppe '$domainLocalGroupName' existiert bereits.`r`n")
}
}
@@ -500,7 +502,7 @@ function Create-Groups {
$form.Controls.Add($exitButton)
# Formular anzeigen
$form.Show()
$form.ShowDialog()
}
# Funktion, die beim Klick auf "ADGDL" ausgeführt wird
@@ -703,7 +705,7 @@ function ADGDL {
})
$form.Controls.Add($exitButton)
$form.Show()
$form.ShowDialog()
}
# Funktion, die beim Klick auf "SMB-Rechte" ausgeführt wird
@@ -968,7 +970,6 @@ function SMB-RIGHTS {
New-ADGroup -Name $dlGroupName -GroupScope DomainLocal -Path $ouPath
$newDLs += $dlGroupName # Hinzufügen des DL-Namens zur Liste
# Erfolgsnachricht (grün)
Add-DebugMessage -message "Erstellt: $dlGroupName" -isPositive $true
} catch {
# Fehlernachricht (schwarz)
Add-DebugMessage -message "Fehler bei der Erstellung der Gruppe '$dlGroupName': $_" -isPositive $false
@@ -990,8 +991,6 @@ function SMB-RIGHTS {
Set-Acl -Path $subfolder.FullName -AclObject $acl
# Füge die Berechtigungen zur Liste hinzu
$newRights += "Recht '$permissionName' auf $($subfolder.FullName) für $dlGroupName gesetzt"
# Erfolgsnachricht (grün)
Add-DebugMessage -message "Berechtigung '$permissionName' auf $($subfolder.FullName) für $dlGroupName gesetzt." -isPositive $true
} catch {
# Fehlernachricht (schwarz)
Add-DebugMessage -message "Fehler beim Setzen der Berechtigung auf $($subfolder.FullName) für '$dlGroupName': $_" -isPositive $false
@@ -1010,6 +1009,8 @@ function SMB-RIGHTS {
# Trennstrich
$separator = '+' * 90 # Zeichen '+' wiederholen
Add-DebugMessage -message $separator -isSeparator $true
[System.Windows.Forms.MessageBox]::Show("Vorgang abgeschlossen.")
})
$form.Controls.Add($startButton)
@@ -1038,7 +1039,7 @@ function SMB-RIGHTS {
}
# Formular anzeigen
$form.Show()
$form.ShowDialog()
}