Other loop for "Remove all existing NTP Servers"

This commit is contained in:
Markus Kraus
2020-05-30 20:59:57 +02:00
parent 8de5885437
commit d2544c9418

View File

@@ -77,8 +77,8 @@ function Set-VMHostSecureNTP {
## Remove all existing NTP Servers
"Remove all existing NTP Servers ..."
try {
foreach ($OldNtpServer in ($MyHost | Get-VMHostNtpServer)) {
$MyHost | Remove-VMHostNtpServer -NtpServer $OldNtpServer -Confirm:$false
$MyHost | Get-VMHostNtpServer | Foreach-Object {
Remove-VMHostNtpServer -VMHost $MyHost -NtpServer $_ -Confirm:$false
}
}
catch [System.Exception] {