Create and manage MSA or grMSA

This commit is contained in:
2025-09-24 02:32:28 +00:00
parent ca6f50c9ff
commit 6e62166710

View File

@@ -29,7 +29,7 @@ $form.Controls.Add($labelDNS)
$textDNS = New-Object System.Windows.Forms.TextBox $textDNS = New-Object System.Windows.Forms.TextBox
$textDNS.Location = New-Object System.Drawing.Point(180,60) $textDNS.Location = New-Object System.Drawing.Point(180,60)
$textDNS.Size = New-Object System.Drawing.Size(180,20) $textDNS.Size = New-Object System.Drawing.Size(180,20)
$textDNS.Text = ".wd.govt.nz" $textDNS.Text = ".domain.placeholder.nz" # Enter your domain "domain.govt.nz" ##################### UPDATE THIS LINE #####################
$textDNS.Enabled = $false $textDNS.Enabled = $false
$form.Controls.Add($textDNS) $form.Controls.Add($textDNS)
@@ -42,7 +42,7 @@ $form.Controls.Add($labelPath)
$textPath = New-Object System.Windows.Forms.TextBox $textPath = New-Object System.Windows.Forms.TextBox
$textPath.Location = New-Object System.Drawing.Point(180,100) $textPath.Location = New-Object System.Drawing.Point(180,100)
$textPath.Size = New-Object System.Drawing.Size(180,20) $textPath.Size = New-Object System.Drawing.Size(180,20)
$textPath.Text = "OU=grMSA,OU=Service Accounts,OU=_Administration,DC=wd,DC=govt,DC=nz" $textPath.Text = "OU=grMSA,OU=Service Accounts,OU=_Administration,DC=domain,DC=placeholder,DC=nz" ##################### UPDATE THIS LINE #####################
$textPath.Enabled = $false $textPath.Enabled = $false
$form.Controls.Add($textPath) $form.Controls.Add($textPath)
@@ -59,7 +59,7 @@ $form.Controls.Add($textMachines)
# Event to update DNS field based on Service Account Name input # Event to update DNS field based on Service Account Name input
$textSVCAccount.Add_TextChanged({ $textSVCAccount.Add_TextChanged({
$textDNS.Text = "$($textSVCAccount.Text).wd.govt.nz" $textDNS.Text = "$($textSVCAccount.Text).domain.placeholder.nz" ##################### UPDATE THIS LINE #####################
}) })
# Create the Submit Button # Create the Submit Button
@@ -73,7 +73,7 @@ $form.Controls.Add($buttonSubmit)
$buttonSubmit.Add_Click({ $buttonSubmit.Add_Click({
$SVCAccount = $textSVCAccount.Text $SVCAccount = $textSVCAccount.Text
$dns = $textDNS.Text $dns = $textDNS.Text
$path = "OU=grMSA,OU=Service Accounts,OU=_Administration,DC=wd,DC=govt,DC=nz" $path = "OU=grMSA,OU=Service Accounts,OU=_Administration,DC=domain,DC=placeholder,DC=nz" ##################### UPDATE THIS LINE #####################
$machines = $textMachines.Text.Split(',') $machines = $textMachines.Text.Split(',')
if (-not [string]::IsNullOrWhiteSpace($SVCAccount) -and -not [string]::IsNullOrWhiteSpace($dns) -and -not [string]::IsNullOrWhiteSpace($path) -and $machines.Count -gt 0) { if (-not [string]::IsNullOrWhiteSpace($SVCAccount) -and -not [string]::IsNullOrWhiteSpace($dns) -and -not [string]::IsNullOrWhiteSpace($path) -and $machines.Count -gt 0) {