Quantcast
Channel: VMware Communities : Popular Discussions - vCloud Director PowerCLI
Viewing all articles
Browse latest Browse all 13334

Adding two new Storage Policies to a couple of OrgvDCs

$
0
0

Hi ,

 

I have a working script for adding a new Storage Policy to a named OrgvDC (Thanks to 900 Foot VM)

Now my Customer would like to add two new Storage Policies (already attached to the PvDC) to ~60 OrgvDCs and change the Policy on a couple of VMs from CSV, which could be done by a trained monkey or by PowerCLI.

 

 

Any ideas on this? The monkey is no option

 

 

Kind regards,

 

 

Michael

 

================================================================================

# Uncomment the next three lines if you are not currently connected to a vCloud Director cell

#add-pssnapin VMware.VimAutomation.Cloud

#$vCloud = Read-Host "Enter a vCloud Director Server"

#Connect-CIServer $vCloud

 

# Prompt for details

$orgName = Read-Host "Enter the Organization name to which resources will be allocated"

$orgvDCName = Read-Host "Enter OrgVDC Name"

$providerVDC = Read-Host "Enter the name of the Provider VDC from which resources will be allocated"

$storageProfile = Read-Host "Enter the Storage Policy to be used by this Org VDC"

 

# Add a Storage Profile to the Org VDC

# Find the desired Storage Profile in the Provider vDC to be added to the Org vDC

$orgPvDCProfile = search-cloud -QueryType ProviderVdcStorageProfile -Name $storageProfile | Get-CIView

 

#Create a new object of type VdcStorageProfileParams and configure the parameters for the Storage Profile

$spParams = new-object VMware.VimAutomation.Cloud.Views.VdcStorageProfileParams

$spParams.Limit = $storage

$spParams.Units = "MB"

$spParams.ProviderVdcStorageProfile = $orgPvDCProfile.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 the Org VDC and create the Storage Profile

$orgVdc = Get-OrgVdc -Name $orgvDCName

$orgVdc.ExtensionData.CreateVdcStorageProfile($UpdateParams)

================================================================================


Viewing all articles
Browse latest Browse all 13334

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>