Create/Update Metadata of Cloud Director Objects (KB#00096)

Overview

You can easily create/modify metadata for any Cloud Director object using GUI but it is a challenge if there is no option to modify or create metadata from GUI and according to your requirement. This is the issue with VMware Cloud Director 10.1.2. This version not only doesn't have this option from GUI but also existing metadata entries are not editable from GUI. This is the reason, I had to find some other way out.

As a solution, either you need to do it from APIs or from PowerShell. I will demonstrate both ways here. You may choose which sounds easy for you. Same method will be followed in future versions as well if VMware haven't plan to change the Metadata Format as they did for older versions of vCD. This is the reason that most of the articles on web don't give you exact information as those are outdated now.

Solution 1: From PowerCLI

=======
$vcd = Read-Host "Enter fqdn/IP here"
Connect-CIServer $vcd
#In below line, you need to specifiy the object whether it is VM, vAPP, Org or OrgvDC. Command will change accordingly. For example, for VM, you will use Get-CIVM. For Org, you will use Get-Org and so on...
$vapp = Get-CIVApp -Name testconsole
$metadata = $vapp.extensiondata.GetMetadata()
$metadata.MetadataEntry = New-Object VMware.VimAutomation.Cloud.Views.MetadataEntry
$metadata.MetadataEntry[0].Key = "vCnotes"
$metadata.MetadataEntry[0].TypedValue = New-Object VMware.VimAutomation.Cloud.Views.MetadataStringValue
$metadata.MetadataEntry[0].TypedValue.Value = "test"
$metadata.MetadataEntry[0].Domain = New-Object VMware.VimAutomation.Cloud.Views.MetadataDomainTag
$metadata.MetadataEntry[0].Domain.Visibility = "readonly"
$metadata.MetadataEntry[0].Domain.Value = "SYSTEM" $vapp.ExtensionData.CreateMetadata($metadata)
=======

Copy the above lines and change it according to your environment and run it. You need to modify the yellow highlighted value according to your environment.

Note that : 

1. To update existing entry, you can run above command by keeping key name same. It will update the existing keys.
2. If you are Tenant Administrator then you won't be able to see the private visible keys but still can modify using this commands.

Solution 2: From any API Tool : It is lengthy and complex one.

I will take sometime to update this post. Meanwhile, enjoy using Solution 1 ;)

For any doubt/error in powercli, feel free to comment.

Reset root account password without restarting esxi host (KB#00095)

Overiew

Generally, if you forgot root account password then you reboot the appliance and then enter grub menu by pressing key 'e' during the boot and then you put the keywords rw init=/bin/bash in the last of first line then you press F10 to save and continue for temp login with root account.

But what if you can't reboot esxi host and have to reset the root password as well. In other words, what if you want to reset root account password without rebooting it anytime.

Sounds interesting, isn't it?

Solution

I will update this post by next weekend. Stay tuned guys!!



Thank you

Check Free IP addresses in Network Pool in Cloud Director (KB#00094)

Overview

This is actually not a big deal when you can check this in cloud director GUI and you would see number of articles to explain this from GUI. But, if there is no option to check the IP address allocation from GUI then it would be far difficult for you if you only work with GUI. My customer reported me that he can't see the assigned or allocated IP addresses and had to ping each and every IP address to check whether its allocated or not. It is actually a headache.

Issue

Two issues were there

1. Checking IP allocation for external network is restricted to System Administrator. My customer was tenant administrator and wanted to check this which is not possible due to product design.
2. If you are System Administrator, you might not get any option to extract the list of IP addresses to store with you or use in excel for quick filter and highlight of free IP addresses etc..
3. Checked on VMware Cloud Director versin 10.1.2

Solution 

Credit goes to powershell here. I could create below script which easily could give you the results. Just copy below output and then paste it into powershell screen from where you can access your cloud director environment.

#

$vcd = Read-Host "Enter vCD url to connect"

Connect-CIServer $vcd

$network = Read-Host "Enter the name of network here"

$ExtNet = Get-ExternalNetwork -Name $network

$ExtNet.ExtensionData.Configuration.IpScopes.IpScope.allocatedipaddresses.IpAddress | Out-GridView

#

Below is sample out-


let's verify the sample output from GUI-


Let me know if you have any thought around it. 

Thank you.