Created
October 12, 2016 14:32
-
-
Save ilandcloud/1d17355bd8f38dd5d0993550b3841db0 to your computer and use it in GitHub Desktop.
The ‘AutoOnOff’ key on its own can be used for a really simple script that checks for the existence of the key and the value being set to ‘Yes’, and will then shut it down.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$vApps = Get-CIVApp | |
$Metadatas = Get-CIMetaData -CIObject $vApps | |
foreach ($Metadata in $Metadatas) { | |
$vApp = $Metadata.CIObject | |
$Key = $Metadata.Key | |
$Value = $Metadata.Value | |
if ($Value -like 'Yes') {write-host 'Stopping vApp....',$vApp} | |
if ($Value -like 'Yes') {Stop-CIVApp -VApp $vApp -Confirm:$false} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment