Skip to content
Snippets Groups Projects
Commit bba2761e authored by Saad Chaaban's avatar Saad Chaaban
Browse files

Update file createComputer_GUI.ps1

parent fdf29020
No related branches found
No related tags found
No related merge requests found
...@@ -103,9 +103,9 @@ $cancelBtn = New-Object system.Windows.Forms.Button ...@@ -103,9 +103,9 @@ $cancelBtn = New-Object system.Windows.Forms.Button
$cancelBtn.BackColor = "#ffffff" $cancelBtn.BackColor = "#ffffff"
$cancelBtn.text = " Script beenden " $cancelBtn.text = " Script beenden "
$cancelBtn.AutoSize = $true $cancelBtn.AutoSize = $true
$cancelBtn.location = New-Object System.Drawing.Point(360,350) $cancelBtn.location = New-Object System.Drawing.Point(360,350)
$cancelBtn.Font = 'Microsoft Sans Serif,10' $cancelBtn.Font = 'Microsoft Sans Serif,10'
$cancelBtn.ForeColor = "#000" $cancelBtn.ForeColor = "#000"
$cancelBtn.DialogResult = [System.Windows.Forms.DialogResult]::Cancel $cancelBtn.DialogResult = [System.Windows.Forms.DialogResult]::Cancel
$AddADComputerForm.CancelButton = $cancelBtn $AddADComputerForm.CancelButton = $cancelBtn
$AddADComputerForm.Controls.Add($cancelBtn) $AddADComputerForm.Controls.Add($cancelBtn)
...@@ -126,6 +126,7 @@ function enable_confirm ...@@ -126,6 +126,7 @@ function enable_confirm
} }
} }
# Fügt Windows Computer in die Vordefenierten Standardgruppen hinzu
function Add-StandardGroups { function Add-StandardGroups {
Write-Host "$($ComputerName.Text)$" Write-Host "$($ComputerName.Text)$"
Add-ADGroupMember grSowiSoftwareFirefoxESR -members "$($ComputerName.Text)$" Add-ADGroupMember grSowiSoftwareFirefoxESR -members "$($ComputerName.Text)$"
...@@ -139,9 +140,6 @@ function Create-Computer { ...@@ -139,9 +140,6 @@ function Create-Computer {
-SamAccountName $($ComputerName.Text) ` -SamAccountName $($ComputerName.Text) `
-Path $($Department_Computer.DistinguishedName[$Department.SelectedIndex-1]) ` -Path $($Department_Computer.DistinguishedName[$Department.SelectedIndex-1]) `
-Description $($ComputerType.Items[$ComputerType.SelectedIndex]) -Description $($ComputerType.Items[$ComputerType.SelectedIndex])
If(($($ComputerName.Text) -like "SOWI-R*") -and ($ComputerType.SelectedIndex -ne 2) -and ($ComputerType.SelectedIndex -ne 3)) {
Add-StandardGroups
}
[System.Windows.MessageBox]::Show(@" [System.Windows.MessageBox]::Show(@"
Es wurden folgender Computer angelegt: Es wurden folgender Computer angelegt:
...@@ -152,8 +150,12 @@ Bereich: $($Department.Items[$Department.SelectedIndex]) ...@@ -152,8 +150,12 @@ Bereich: $($Department.Items[$Department.SelectedIndex])
Typ: $($ComputerType.Items[$ComputerType.SelectedIndex]) Typ: $($ComputerType.Items[$ComputerType.SelectedIndex])
"@, 'Info') "@, 'Info')
If(($($ComputerName.Text) -like "SOWI-R*") -and ($ComputerType.SelectedIndex -ne 2) -and ($ComputerType.SelectedIndex -ne 3)) {
Add-StandardGroups
}
} }
catch { catch {
# Gibt die Fehlermeldung aus, sofern es eine gibt.
[System.Windows.MessageBox]::Show(@" [System.Windows.MessageBox]::Show(@"
Ein Fehler ist aufgetreten: Ein Fehler ist aufgetreten:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment