Avoid System.Management.Automation.Internal.Host.InternalHost variable collision

This commit is contained in:
2026-01-29 10:18:28 +13:00
parent 22714b536d
commit eaae091e36

View File

@@ -75,8 +75,8 @@ function Get-CommonZoneFromHosts {
if (-not $fqdnHosts -or $fqdnHosts.Count -eq 0) { return "" } if (-not $fqdnHosts -or $fqdnHosts.Count -eq 0) { return "" }
$commonSuffix = $null $commonSuffix = $null
foreach ($host in $fqdnHosts) { foreach ($hostName in $fqdnHosts) {
$clean = $host.Trim().TrimEnd(".") $clean = $hostName.Trim().TrimEnd(".")
$labels = $clean -split "\." $labels = $clean -split "\."
if ($labels.Count -lt 2) { continue } if ($labels.Count -lt 2) { continue }
$zoneLabels = $labels[1..($labels.Count - 1)] $zoneLabels = $labels[1..($labels.Count - 1)]