From ad120a0818171a6f03d0dd78c19b8bd170779707 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Wed, 31 Jan 2024 10:35:13 -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 5f19f24d..f3451c8c 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="Where {"+$args[0]+"}" -write-host $WHERE -& Get-VMHost | $WHERE | Get-VM | Where {$_.PowerState -like '*On*' -and $_.Name -notlike '*CLS*' -and $_.Name -notlike '*iSCSI*'} +$COMMAND="Get-VMHost | Where {"+$args[0]+"} | Get-VM" +write-host $COMMAND +& $COMMAND | Where {$_.PowerState -like '*On*' -and $_.Name -notlike '*CLS*' -and $_.Name -notlike '*iSCSI*'} Disconnect-VIServer -Server $VCENTERHOST -Force –Confirm:$false