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
# Set up an array for the final report | |
$report = @() | |
# Get all vApp from the Org | |
$vApps = Get-CIVApp | |
foreach ($vApp in $vApps) { | |
# Get the metadata key/value pairs for all vApps | |
$Metadatas = Get-CIMetaData -CIObject $vApp |
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
Connect-CIServer -server ‘sin01.ilandcloud.com’ -User ‘username’ -Password ‘password’ -Org ‘YourOrg | |
# Read existing CSV file with metadata requirements | |
$file = 'c:\temp\metadata.csv' | |
# Read the CSV file into an array | |
$requirements = Import-Csv -Path $file | |
# Trundle through the array, getting the requirements per vApp | |
foreach ($requirement in $requirements){ | |
$vApp = $requirement.vApp |
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
Function New-CIMetaData { | |
<# | |
.SYNOPSIS | |
Creates a Metadata Key/Value pair. | |
.DESCRIPTION | |
Creates a custom Metadata Key/Value pair on a specified vCloud object | |
.PARAMETER Key | |
The name of the Metadata to be applied. | |
.PARAMETER Value |
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
# Connect to iland cloud | |
Connect-CIServer -server ‘sin01.ilandcloud.com’ -User ‘username’ -Password ‘password’ -Org ‘YourOrg | |
# Get the current time, and specifically hour in 24 hour format | |
$time = Get-Date -DisplayHint Time | |
$today = Get-Date -UFormat %a | |
$hour = $time.Hour | |
# Get a list of all the vApps in the Org | |
$vApps = Get-CIVApp |
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
Function Get-CIMetaData { | |
<# | |
.SYNOPSIS | |
Retrieves all Metadata Key/Value pairs. | |
.DESCRIPTION | |
Retrieves all custom Metadata Key/Value pairs on a specified vCloud object | |
.PARAMETER CIObject | |
The object on which to retrieve the Metadata. |
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} | |
} |