RSS

PS: Getting a virtual machine’s properties in vRA

02 Aug

Getting the properties of a VM provisioned in vRA is not straight forward, you need to get those information from the IaaS Web server instead of from vRA

This site shows you how you can get to it.

I am not sure which version the author has, but in version 7.2 the properties are not so straight forward and they strangely don’t expand when exported to a JSON file. However let’s first deal with the NTLM authentication on IaaS Web via a Invoke-RestMethod call. Its actually very straight forward, but hard to find; simply speaking, you use get-credential to capture the windows credentials and input it with -credential parameter.

Here is the REST call using the example in the link:

$query = "https://{{vra-iaas}}/repository/Data/ManagementModelEntities.svc/VirtualMachines(guid’76e88125-8c81-4de0-82d9-f3e6f41f9531′)/VirtualMachineProperties"

$response = Invoke-RestMethod -Method Get -Uri $rq -Credential $cred

The $response object is an array of properties object. Example

PS > $response[1]

id : https://{iaasweb}/Repository/data/ManagementmodelEntities.svc/VirtualMachineProperties(1239430)
category : category
link : {link, link}
title :
updated : 2018-08-02T01:09:35Z
author : author
content : content

But where are the properties and their values? They are in content and you can extract the properties as such

$response | ft @{l="Name";e={$_.content.properties.PropertyName}},@{l="Value";e={$_.content.properties.PropertyValue}}

Advertisements
 
Leave a comment

Posted by on August 2, 2018 in powershell, vmware

 

Tags: ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

 
%d bloggers like this: