Skip to content

Instantly share code, notes, and snippets.

@davelee212
Created September 2, 2016 07:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save davelee212/14873e86db4519fddae87f16a4cdf6b2 to your computer and use it in GitHub Desktop.
Save davelee212/14873e86db4519fddae87f16a4cdf6b2 to your computer and use it in GitHub Desktop.
Add Storage Profile to Org vDC
# This script is intended to be used as part of a script to automatically create Organisation VDCs in vCloud Director.
# Find the Storage Profile in the Provider vDC to be added to the Org vDC
$BronzePvDCProfile = search-cloud -QueryType ProviderVdcStorageProfile -Name "Bronze Storage" | Get-CIView
# Create a new object of type VdcStorageProfileParams and fill in the parameters for the new Org vDC passing in the href of the Provider vDC Storage Profile
$spParams = new-object VMware.VimAutomation.Cloud.Views.VdcStorageProfileParams
$spParams.Limit = 512000
$spParams.Units = "MB"
$spParams.ProviderVdcStorageProfile = $BronzePvDCProfile.href
$spParams.Enabled = $true
$spParams.Default = $false
# Create an UpdateVdcStorageProfiles object and put the new parameters into the AddStorageProfile element
$UpdateParams = new-object VMware.VimAutomation.Cloud.Views.UpdateVdcStorageProfiles
$UpdateParams.AddStorageProfile = $spParams
# Get my test Org vDC
$orgVdc = Get-OrgVdc -Name DLTestOrg
# Create the new Storage Profile entry in my test Org vDC
$orgVdc.ExtensionData.CreateVdcStorageProfile($UpdateParams)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment