diff --git a/certy.ps1 b/certy.ps1 index 7696fad..6beae28 100644 --- a/certy.ps1 +++ b/certy.ps1 @@ -892,7 +892,7 @@ $csrImportBtn.Add_Click({ return } - $csrHosts = $csrFiles | ForEach-Object { $_.BaseName.Trim() } | Where-Object { $_ } + $csrHosts = @($csrFiles | ForEach-Object { $_.BaseName.Trim() } | Where-Object { $_ }) $currentHosts = Split-List $hostsBox.Text $merged = Merge-Hostnames -Existing $currentHosts -NewItems $csrHosts $hostsBox.Text = ($merged -join [Environment]::NewLine) @@ -905,7 +905,7 @@ $csrImportBtn.Add_Click({ $dnsScanBtn.Add_Click({ try { $dnsListBox.Items.Clear() - $servers = Get-DnsServerCandidates + $servers = @(Get-DnsServerCandidates) if (-not $servers -or $servers.Count -eq 0) { & $logAction "No DNS servers found. Enter servers manually." return @@ -1025,7 +1025,7 @@ $runBtn.Add_Click({ throw "PFX password is required." } - $hostEntries = $hosts | ForEach-Object { Resolve-HostEntry -Name $_ -Zone $zone -UseProvidedFqdn $useFqdnBox.Checked } | Where-Object { $_ } + $hostEntries = @($hosts | ForEach-Object { Resolve-HostEntry -Name $_ -Zone $zone -UseProvidedFqdn $useFqdnBox.Checked } | Where-Object { $_ }) & $logAction "Processing $($hostEntries.Count) hostname(s)." @@ -1037,7 +1037,7 @@ $runBtn.Add_Click({ if ($selectedReplicationTargets.Count -gt 0) { $replicationTargets = $selectedReplicationTargets } else { - $replicationTargets = Split-List $replicationTargetsBox.Text + $replicationTargets = @(Split-List $replicationTargetsBox.Text) if ($replicationTargets.Count -eq 0 -and $dnsServer) { $replicationTargets = @($dnsServer) & $logAction "Replication targets empty; using primary DNS server $dnsServer." @@ -1071,7 +1071,7 @@ $runBtn.Add_Click({ -Log $logAction } } else { - $hostList = $hostEntries | ForEach-Object { $_.Fqdn } + $hostList = @($hostEntries | ForEach-Object { $_.Fqdn } | Where-Object { $_ }) & $logAction "Requesting one certificate with $($hostList.Count) hostname(s)." Invoke-Wacs ` -WacsPath $wacsPath `