From cbcd364247f36412dd6a0fe037c66930a901274a Mon Sep 17 00:00:00 2001 From: Rephl3x Date: Thu, 29 Jan 2026 10:58:41 +1300 Subject: [PATCH] Improve repadmin syncall targeting --- certy.ps1 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/certy.ps1 b/certy.ps1 index ddf5a51..462448a 100644 --- a/certy.ps1 +++ b/certy.ps1 @@ -238,6 +238,12 @@ function Invoke-Replication { foreach ($server in $targets) { $cmd = if ($Command -match "\{server\}") { $Command.Replace("{server}", $server) } else { $Command } $cmd = $cmd.Trim() + if ($cmd -match "^(?i)\s*/repadmin\b") { + $cmd = $cmd -replace "^(?i)\s*/repadmin\b", "repadmin" + } + if ($server -and $cmd -match "(?i)\brepadmin\b" -and $cmd -match "(?i)\bsyncall\b" -and $cmd -notmatch "\{server\}") { + $cmd = $cmd -replace "(?i)\bsyncall\b", "syncall $server" + } if ([string]::IsNullOrWhiteSpace($cmd)) { continue } & $Log "Replication: $cmd" & $env:ComSpec /c $cmd | ForEach-Object { & $Log $_ } @@ -578,7 +584,7 @@ $y += 70 + $gap Add-Label "Replication command ({server} optional)" $xLabel $y $labelWidth $rowHeight $replicationCmdBox = Add-TextBox $xInput $y $inputWidth $rowHeight $false -$replicationCmdBox.Text = "repadmin /syncall {server} /A /e /P /d" +$replicationCmdBox.Text = "repadmin /syncall {server} /AdeP" $y += $rowHeight + ($gap * 2) Add-SectionHeader "ACME / Output" @@ -948,6 +954,10 @@ $runBtn.Add_Click({ $replicationTargets = $selectedReplicationTargets } else { $replicationTargets = Split-List $replicationTargetsBox.Text + if ($replicationTargets.Count -eq 0 -and $dnsServer) { + $replicationTargets = @($dnsServer) + & $logAction "Replication targets empty; using primary DNS server $dnsServer." + } } Invoke-Replication -Servers $replicationTargets -Command $replicationCmdBox.Text -Log $logAction } else {