Home > Blogs > VMware PowerCLI Blog > Tag Archives: vCD

Tag Archives: vCD

PowerCLI For Tenants Merges into PowerCLI 6.0 R1 Installer




It’s a great day in PowerCLI! As of PowerCLI 6.0 R1, we have merged the PowerCLI for Tenants installer into the core PowerCLI installer. Now customers only need to download a single installer for all PowerCLI use-cases. When installing PowerCLI you will be prompted to choose which ‘Features’ you would like to install.




Why is this great? This is great because now it is easier for our customers to install PowerCLI and select the items they need. One download, one install… Simplicity.

Continue reading

Automating creation of vCD Organizations, Users and Org vDCs

Posted by
Alan Renouf
Technical Marketing

In Part 1 of this blog series I wrote about how I presented together with a colleague of mine Vladimir Goranov at Partner Exchange 2012.  I already showed you the reporting script and demonstration on how to create graphs straight from PowerCLI which detail the resources and statistics in your Cloud Infrastructure (CI).

Following the reporting side of the vCloud Director snap-in we explained that although in PowerCLI 5.0.1 the cmdlets were mainly “GET” cmdlets which retrieved data from the Cloud there was also a cmdlet called Get-CIView and a property on the returned objects called .ExtensionData.

The Get-CIView cmdlet and ExtensionData property exposes the entire vCloud Director API and allows us to make changes to the CI, this opens up multiple possibilities and moves us away from just retrieving data and allows us to create and alter our CI.

In our presentation we showed how the current cmdlets could be used to create some advanced functions which would look just like PowerShell cmdlets and could be used to create new Organizations, Users and Organizational vDC's.

We then used the scenario of a service provider having to add multiple new Organizations into their CI, would they add these one by one using the GUI ? Maybe they already have their own product which integrates into the vCloud Director APIs and they didn’t need to do this but for those looking for a free and easy way to create multiple Orgs we showed how easy it was to create 50 new orgs in less than 2 minutes.

Creating 50 new Organizations in less than 2 minutes

The below video was used in the presentation we gave at Partner Exchange, follow through to see the creation of a single Org, User and Org vDC and then how we can create 50 orgs in less than 2 minutes from an Excel spreadsheet:

The Scripts

Below are the scripts and examples we used in the presentation, please note these are not fully formed cmdlets and are shown as examples of how you can use the Get-CIView cmdlet and ExtensionData to create these CI objects, you may need to adjust these functions to perform extra tasks or to work in your CI.

Function New-Org {
    Param (
    Process {
        $vcloud = $DefaultCIServers[0].ExtensionData
        $AdminOrg = New-Object VMware.VimAutomation.Cloud.Views.AdminOrg
        $adminOrg.Name = $name
        $adminOrg.FullName = $FullName
        $adminOrg.Description = $description
        $adminOrg.IsEnabled = $Enabled

        $orgSettings = New-Object VMware.VimAutomation.Cloud.Views.OrgSettings
        $orgGeneralSettings = New-Object VMware.VimAutomation.Cloud.Views.OrgGeneralSettings
        $orgGeneralSettings.CanPublishCatalogs = $PublishCatalogs
        $orgSettings.OrgGeneralSettings = $orgGeneralSettings

        $adminOrg.Settings = $orgSettings

        $org = $vcloud.CreateOrg($adminOrg)
        Get-Org -Name $name

Function New-CIUser {
    Param (
    Process {
        $OrgED = (Get-Org $Org).ExtensionData
        $orgAdminUser = New-Object VMware.VimAutomation.Cloud.Views.User
        $orgAdminUser.Name = $Name
        $orgAdminUser.FullName = $FullName
        $orgAdminUser.Password = $Pasword
        $orgAdminUser.IsEnabled = $Enabled

        $vcloud = $DefaultCIServers[0].ExtensionData
        $orgAdminRole = $vcloud.RoleReferences.RoleReference | where {$_.Name -eq $Role}
        $orgAdminUser.Role = $orgAdminRole
        $user = $orgED.CreateUser($orgAdminUser)
        Get-CIUser -Org $Org -Name $Name

Function New-OrgVDC {
    Param (
    Process {
        $adminVdc = New-Object VMware.VimAutomation.Cloud.Views.AdminVdc
        $adminVdc.Name = $name
        $adminVdc.IsEnabled = $Enabled
        $providerVdc = Get-ProviderVdc $ProviderVDC
        $providerVdcRef = New-Object VMware.VimAutomation.Cloud.Views.Reference
        $providerVdcRef.Href = $providerVdc.Href
        $adminVdc.ProviderVdcReference =$providerVdcRef
        $adminVdc.AllocationModel = $AllocationModel
        $adminVdc.ComputeCapacity = New-Object VMware.VimAutomation.Cloud.Views.ComputeCapacity
        $adminVdc.ComputeCapacity.Cpu = New-Object VMware.VimAutomation.Cloud.Views.CapacityWithUsage
        $adminVdc.ComputeCapacity.Cpu.Units = "MHz"
        $adminVdc.ComputeCapacity.Cpu.Limit = $CPULimit
        $adminVdc.ComputeCapacity.Cpu.Allocated = $CPUAllocated
        $adminVdc.ComputeCapacity.Memory = New-Object VMware.VimAutomation.Cloud.Views.CapacityWithUsage
        $adminVdc.ComputeCapacity.Memory.Units = "MB"
        $adminVdc.ComputeCapacity.Memory.Limit = $MEMLimit
        $adminVdc.ComputeCapacity.Memory.Allocated = $MEMAllocated
        $adminVdc.StorageCapacity = New-Object VMware.VimAutomation.Cloud.Views.CapacityWithUsage
        $adminVdc.StorageCapacity.Units = "MB"
        $adminVdc.StorageCapacity.Limit = $StorageLimit
        $OrgED = (Get-Org $Org).ExtensionData
        $orgVdc = $orgED.CreateVdc($adminVdc)
        Get-OrgVdc $name

# Connect to our Cloud Infrastructure
Connect-CIServer vCloud

# Create a new Org
New-Org -Name "PowerCLIRocks" -FullName "PowerCLI Rocks hard!" -description "PowerCLI really rocks hard." -Enabled

# Create a new Administrator for that Org
New-CIUser -Enabled -Name "PowerCLIRocksAdmin" -FullName "PowerCLI Rocks Administrator"
    -Pasword "Pa$$w0rd" -Org "PowerCLIRocks" -Role "Organization Administrator"

# Create a new Org VDC for that Org
New-OrgVDC -Name "PowerCLIRocksVDC" -Org "PowerCLIRocks"-AllocationModel "AllocationPool" -Enabled

    -CPUAllocated 500 -CPULimit 1000 -MEMAllocated 1000 -MEMLimit 2000 -ProviderVDC "Bronze" -StorageLimit 1024

# Create all the Urgent Orgs
Import-Csv c:\UrgentWork\UrgentOrgs.csv | Foreach {
    New-Org -Name $_.OrgName -FullName $_.OrgFullName -description $_.OrgDesc -Enabled

Get notification of new blog postings and more by following VMware PowerCLI on Twitter: @PowerCLI

Checking the Pay-As-You-Go MHz Issue

Whilst sitting in a vCD Deep Dive presentation by Aidan Dalgliesh and David Hill last week at the London VMUG they explained an issue which has been reported on multiple occasions, they have seen this more than once on customer deployments and the issue had been reported on the internet both by Massimo Re Ferre and Kendrick Coleman.

When setting up a new Organization vDC with a Pay-As-You-Go model the default vCPU Speed is set to 0.26 GHz, most people continue on through the wizard without changing this and end up crippling their VMs as this adds a CPU limit onto the VM meaning the VM will never get past this speed limit.


This of course gives us a great reason to produce a one-liner from the PowerCLI vCD snapin to check your complete cloud infrastructure for any Organization vDCs which may have this default still enabled.

Get-OrgVdc | Where {$_.AllocationModel -eq "PayAsYouGo"} | Where {$_.ExtensionData.VCpuInMhz -eq 260}

As you can see, the above one-liner firstly grabs all Organization vDCs and then checks these to see if their allocation model is “PayAsYouGo”, once it has found these it will check the vCPUInMHZ property to see if it is set to 260 or 0.26GHz.

An example of this can be seen below: