This commit is contained in:
2024-02-01 16:26:07 -06:00
parent f38cd62027
commit ab32843473
3 changed files with 6 additions and 9 deletions

View File

@@ -6,9 +6,7 @@ Connect-VIServer -Server $VCENTERHOST -Protocol https -User $VCENTERUSER -Passwo
$vmhosts=$args[0].Split(",")
Foreach ($vmhost in $vmhosts)
{
# Get-VMHost | Where {$_.Name -eq $vmhost} | Get-VM | Where {$_.PowerState -like '*On*' -and $_.Name -notlike '*CLS*' -and $_.Name -notlike '*iSCSI*'} | Shutdown-VMGuest -Confirm:$false
write-host $vmhost
Get-VMHost | Where {$_.Name -eq $vmhost} | Get-VM | Where {$_.PowerState -like '*On*' -and $_.Name -notlike '*CLS*' -and $_.Name -notlike '*iSCSI*'}
Get-VMHost | Where {$_.Name -eq $vmhost} | Get-VM | Where {$_.PowerState -like '*On*' -and $_.Name -notlike '*CLS*' -and $_.Name -notlike '*iSCSI*'} | Shutdown-VMGuest -Confirm:$false
}
Disconnect-VIServer -Server $VCENTERHOST -Force Confirm:$false