From 6acf700fa60b88e4f8526d8cc3d3740fef61100c Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Thu, 1 Feb 2024 08:32:06 -0600 Subject: [PATCH] Update vm-shutdown.ps1 --- esxi-scripts/vm-shutdown.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esxi-scripts/vm-shutdown.ps1 b/esxi-scripts/vm-shutdown.ps1 index 0db90970..6672fdd2 100755 --- a/esxi-scripts/vm-shutdown.ps1 +++ b/esxi-scripts/vm-shutdown.ps1 @@ -6,8 +6,8 @@ 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 - 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 + # Get-VMHost | Where {$_.Name -eq $vmhost} | Get-VM | Where {$_.PowerState -like '*On*' -and $_.Name -notlike '*CLS*' -and $_.Name -notlike '*iSCSI*'} } Disconnect-VIServer -Server $VCENTERHOST -Force –Confirm:$false