Created
October 12, 2016 14:57
-
-
Save ilandcloud/88247a9f789b36b5e3d3e973695b0b4c to your computer and use it in GitHub Desktop.
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 | |
$Days = $requirement.Days | |
$StopTime = $requirement.StopTime | |
$StartTime = $requirement.StartTime | |
$AutoOnOff = $requirement.AutoOnOff | |
# Apply the metadata to the vApp (will overwrite previous key/value pairs) | |
$target = Get-CIVApp -Name $vApp | |
New-CIMetaData -Key "Days" -Value $Days -CIObject $target | |
New-CIMetaData -Key "StopTime" -Value $StopTime -CIObject $target | |
New-CIMetaData -Key "StartTime" -Value $StartTime -CIObject $target | |
New-CIMetaData -Key "AutoOnOff" -Value $AutoOnOff -CIObject $target | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment