From 12f8687fedf96d1f25d573caac32b69de0eeaab7 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Wed, 31 Jan 2024 10:30:05 -0600 Subject: [PATCH] Update vm-shutdown.ps1 --- esxi-scripts/vm-shutdown.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/esxi-scripts/vm-shutdown.ps1 b/esxi-scripts/vm-shutdown.ps1 index 3b613f6b..a995ec0c 100755 --- a/esxi-scripts/vm-shutdown.ps1 +++ b/esxi-scripts/vm-shutdown.ps1 @@ -5,9 +5,9 @@ Connect-VIServer -Server $VCENTERHOST -Protocol https -User $VCENTERUSER -Passwo #Get-VMHost | Where {$args[0]} | Get-VM | Where {$_.PowerState -like '*On*' -and $_.Name -notlike '*CLS*' -and $_.Name -notlike '*iSCSI*'} | Shutdown-VMGuest -Confirm:$false -$where="Get-VMHost | Where {"+$args[0]+"} | Get-VM | Where {$_.PowerState -like '*On*' -and $_.Name -notlike '*CLS*' -and $_.Name -notlike '*iSCSI*'}" -write-host $where -$where +$COMMAND="Get-VMHost | Where {"+$args[0]+"} | Get-VM | Where {$_.PowerState -like '*On*' -and $_.Name -notlike '*CLS*' -and $_.Name -notlike '*iSCSI*'}" +write-host $COMMAND +& $COMMAND Disconnect-VIServer -Server $VCENTERHOST -Force –Confirm:$false