Add DNS-only mode toggle
This commit is contained in:
30
certy.ps1
30
certy.ps1
@@ -637,6 +637,8 @@ $verboseBox = Add-CheckBox "Verbose" $xInput $y 120 $rowHeight
|
|||||||
$runWacsBox = Add-CheckBox "Run WACS after DNS update" ($xInput + 140) $y 260 $rowHeight
|
$runWacsBox = Add-CheckBox "Run WACS after DNS update" ($xInput + 140) $y 260 $rowHeight
|
||||||
$perHostBox = Add-CheckBox "One cert per host" ($xInput + 430) $y 180 $rowHeight
|
$perHostBox = Add-CheckBox "One cert per host" ($xInput + 430) $y 180 $rowHeight
|
||||||
$runWacsBox.Checked = $true
|
$runWacsBox.Checked = $true
|
||||||
|
$y += $rowHeight + $gap
|
||||||
|
$disableCertsBox = Add-CheckBox "Turn off cert generation (DNS-only mode)" $xInput $y 360 $rowHeight
|
||||||
$y += $rowHeight + ($gap * 2)
|
$y += $rowHeight + ($gap * 2)
|
||||||
|
|
||||||
$runBtn = New-Object System.Windows.Forms.Button
|
$runBtn = New-Object System.Windows.Forms.Button
|
||||||
@@ -694,6 +696,23 @@ function Update-ReplicationUI {
|
|||||||
$dnsListBox.Enabled = $enabled
|
$dnsListBox.Enabled = $enabled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Update-CertGenerationUI {
|
||||||
|
$disabled = $disableCertsBox.Checked
|
||||||
|
$runWacsBox.Enabled = -not $disabled
|
||||||
|
$perHostBox.Enabled = -not $disabled
|
||||||
|
if ($disabled) {
|
||||||
|
$runWacsBox.Checked = $false
|
||||||
|
}
|
||||||
|
|
||||||
|
$wacsPathBox.Enabled = -not $disabled
|
||||||
|
$outputTypeBox.Enabled = -not $disabled
|
||||||
|
$outputPathBox.Enabled = -not $disabled
|
||||||
|
$pfxPasswordBox.Enabled = -not $disabled
|
||||||
|
$baseUriBox.Enabled = -not $disabled
|
||||||
|
$validationBox.Enabled = -not $disabled
|
||||||
|
$validationPortBox.Enabled = -not $disabled
|
||||||
|
}
|
||||||
|
|
||||||
$loadedDefaults = Load-Defaults
|
$loadedDefaults = Load-Defaults
|
||||||
if ($loadedDefaults) {
|
if ($loadedDefaults) {
|
||||||
if ($loadedDefaults.DefaultZone) { $zoneBox.Text = $loadedDefaults.DefaultZone }
|
if ($loadedDefaults.DefaultZone) { $zoneBox.Text = $loadedDefaults.DefaultZone }
|
||||||
@@ -714,10 +733,12 @@ if ($loadedDefaults) {
|
|||||||
if ($null -ne $loadedDefaults.RunWacs) { $runWacsBox.Checked = [bool]$loadedDefaults.RunWacs }
|
if ($null -ne $loadedDefaults.RunWacs) { $runWacsBox.Checked = [bool]$loadedDefaults.RunWacs }
|
||||||
if ($null -ne $loadedDefaults.Verbose) { $verboseBox.Checked = [bool]$loadedDefaults.Verbose }
|
if ($null -ne $loadedDefaults.Verbose) { $verboseBox.Checked = [bool]$loadedDefaults.Verbose }
|
||||||
if ($null -ne $loadedDefaults.PerHostCerts) { $perHostBox.Checked = [bool]$loadedDefaults.PerHostCerts }
|
if ($null -ne $loadedDefaults.PerHostCerts) { $perHostBox.Checked = [bool]$loadedDefaults.PerHostCerts }
|
||||||
|
if ($null -ne $loadedDefaults.DisableCertGeneration) { $disableCertsBox.Checked = [bool]$loadedDefaults.DisableCertGeneration }
|
||||||
if ($loadedDefaults.OutputType) { $outputTypeBox.SelectedItem = $loadedDefaults.OutputType }
|
if ($loadedDefaults.OutputType) { $outputTypeBox.SelectedItem = $loadedDefaults.OutputType }
|
||||||
if (-not $outputTypeBox.SelectedItem) { $outputTypeBox.SelectedIndex = 0 }
|
if (-not $outputTypeBox.SelectedItem) { $outputTypeBox.SelectedIndex = 0 }
|
||||||
Update-OutputTypeUI
|
Update-OutputTypeUI
|
||||||
if (Test-Path function:Update-ReplicationUI) { Update-ReplicationUI }
|
if (Test-Path function:Update-ReplicationUI) { Update-ReplicationUI }
|
||||||
|
Update-CertGenerationUI
|
||||||
& $logAction "Defaults loaded from $(Get-DefaultsPath)."
|
& $logAction "Defaults loaded from $(Get-DefaultsPath)."
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -875,6 +896,10 @@ $outputTypeBox.Add_SelectedIndexChanged({
|
|||||||
Update-OutputTypeUI
|
Update-OutputTypeUI
|
||||||
})
|
})
|
||||||
|
|
||||||
|
$disableCertsBox.Add_CheckedChanged({
|
||||||
|
Update-CertGenerationUI
|
||||||
|
})
|
||||||
|
|
||||||
$saveDefaultsBtn.Add_Click({
|
$saveDefaultsBtn.Add_Click({
|
||||||
$defaults = [pscustomobject]@{
|
$defaults = [pscustomobject]@{
|
||||||
DefaultZone = $zoneBox.Text
|
DefaultZone = $zoneBox.Text
|
||||||
@@ -894,6 +919,7 @@ $saveDefaultsBtn.Add_Click({
|
|||||||
RunWacs = $runWacsBox.Checked
|
RunWacs = $runWacsBox.Checked
|
||||||
Verbose = $verboseBox.Checked
|
Verbose = $verboseBox.Checked
|
||||||
PerHostCerts = $perHostBox.Checked
|
PerHostCerts = $perHostBox.Checked
|
||||||
|
DisableCertGeneration = $disableCertsBox.Checked
|
||||||
}
|
}
|
||||||
Save-Defaults -Defaults $defaults
|
Save-Defaults -Defaults $defaults
|
||||||
& $logAction "Defaults saved to $(Get-DefaultsPath)."
|
& $logAction "Defaults saved to $(Get-DefaultsPath)."
|
||||||
@@ -964,7 +990,9 @@ $runBtn.Add_Click({
|
|||||||
& $logAction "Replication disabled."
|
& $logAction "Replication disabled."
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($runWacsBox.Checked) {
|
if ($disableCertsBox.Checked) {
|
||||||
|
& $logAction "Cert generation disabled; DNS updates/replication only."
|
||||||
|
} elseif ($runWacsBox.Checked) {
|
||||||
$wacsPath = $wacsPathBox.Text.Trim()
|
$wacsPath = $wacsPathBox.Text.Trim()
|
||||||
if (-not (Test-Path -Path $wacsPath -PathType Leaf)) {
|
if (-not (Test-Path -Path $wacsPath -PathType Leaf)) {
|
||||||
throw "WACS not found at: $wacsPath"
|
throw "WACS not found at: $wacsPath"
|
||||||
|
|||||||
Reference in New Issue
Block a user