Sharing vApps in vCloud with PowerCLI

June 11, 2013

Table of Contents

Some times vCloud Directors give the organization users grainy control over the the level of access users have to vApps , this is all controlled through the the vCloud API and powerCLI. The code below takes vApps‘ current settings and allow the user to modify the vApp:

# Get our required Objects

$vapp = Get-CIVApp “My vApp”

$user = Get-CIUser “UserToBeAdded”

# Access Level can be one of: ReadOnly,Change,FullControl

$accessLevel = “Change”

# Get current access policy from vApp

$access = $vapp.ExtensionData.GetControlAccess()

if (!$access.AccessSettings)


 $access.AccessSettings = New-Object VMware.VimAutomation.Cloud.Views.AccessSettings


# New Access object

$newAccess = new-object VMware.VimAutomation.Cloud.Views.AccessSetting

$newAccess.Subject = New-Object VMware.VimAutomation.Cloud.Views.Reference

# Set our access level

$newAccess.AccessLevel = $accessLevel

# Insert user href

$newAccess.Subject.Href = $user.ExtensionData.Href

$newAccess.Subject.Type = “application/vnd.vmware.admin.user+xml”

# Add new access to vApp access settings object

$access.AccessSettings.AccessSetting += $newAccess

#Send new Access config


A user is also able to control the default access policyand the level-using:

$access.IsSharedToEveryone and $access


Share on
More posts

Dedicated Servers Quick Guide

What is a Dedicated Servers? Why bother using a dedicated server over a VPS or Shared Hosting?A dedicated server is a server 100% dedicated to your website/project or business needs.

vCloud API 5.1 Metadata

Over the years there has been a lot of changes in metadata in vCloud director,so am going to give te difference between the metadata in vCloud director 5.1 and the

Get 90% Discount

First 3 People gets the Bonus!
Don't Miss Out Our Big Sale

Get 0-90% On All
247Rack Services


The Sale Is Until The End Of March