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