scripts/AD_USER_CREATE.ps1 aktualisiert
This commit is contained in:
@@ -74,13 +74,15 @@ $dataGridView.Columns[0].Name = "Titel" # Titel in der ersten Spalte
|
||||
$dataGridView.Columns[1].Name = "Vorname" # Vorname
|
||||
$dataGridView.Columns[2].Name = "Nachname" # Nachname
|
||||
$dataGridView.Columns[3].Name = "Globalgruppe" # Globalgruppe
|
||||
$dataGridView.Columns[4].Name = "OU" # OU
|
||||
$dataGridView.Columns[4].Name = "OU" # OU (wird als ComboBox hinzugefügt)
|
||||
$dataGridView.Columns[5].Name = "Standardpasswort" # Standardpasswort
|
||||
|
||||
# Funktion zum Abrufen der verfügbaren OUs
|
||||
function Get-OUs {
|
||||
return Get-ADOrganizationalUnit -Filter * | Select-Object -ExpandProperty DistinguishedName
|
||||
}
|
||||
# Dropdown für die OU in der DataGridView-ComboBox-Spalte
|
||||
$ouComboBoxColumn = New-Object System.Windows.Forms.DataGridViewComboBoxColumn
|
||||
$ouComboBoxColumn.HeaderText = "OU"
|
||||
$ouComboBoxColumn.Items.AddRange($ouList) # Hier fügen wir alle OUs hinzu
|
||||
$dataGridView.Columns.RemoveAt(4) # Entfernt die ursprüngliche OU-Spalte
|
||||
$dataGridView.Columns.Insert(4, $ouComboBoxColumn) # Fügt die ComboBox-Spalte an der richtigen Stelle ein
|
||||
|
||||
# Funktion zum Setzen der OUs für alle Zeilen im DataGridView
|
||||
function Update-OUsInGrid {
|
||||
@@ -118,7 +120,7 @@ $okButton.Add_Click({
|
||||
$firstName = $row.Cells[1].Value
|
||||
$lastName = $row.Cells[2].Value
|
||||
$globalGroup = $row.Cells[3].Value
|
||||
$ou = $row.Cells[4].Value # Nun enthält $ou den DistinguishedName der OU
|
||||
$ou = $row.Cells[4].Value # Hier wird die ausgewählte OU aus der ComboBox abgerufen
|
||||
$password = $row.Cells[5].Value
|
||||
|
||||
# Überprüfen, ob notwendige Felder ausgefüllt sind
|
||||
|
||||
Reference in New Issue
Block a user