• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Crazy Consultant

Focus on cloud-native, AI and virtualization technologies

  • Home
  • Knowledge Library
    • Golden Kubestronaut Study Guide
    • Nutanix Study Guide
    • Nutanix Expert Challenge
    • Enterprise Kubernetes Platform Design Dimensions
    • Kubestronaut Challenge
    • Multiple‑Choice Exam Tips
  • News
  • Onyku®

Export ViewBase object properties PowerCLI

June 1, 2016 by Christophe Calvet Leave a Comment

Export ViewBase object properties and child objects properties with PowerCLI.

The script below has been created initially to extract the list of all properties and child properties of any ViewBase object to ease the creation of another script in another project that will be released soon.

It also generate a XML file as a “kind” of UML diagram for this object and all child objects.

vmware.vim.dll:
The data are extracted from “vmware.vim.dll”
Installed by default with PowerCLI
Auto-generated .Net binding to the vSphere API on which the vSphere PowerCLI is developed

Information in this “dll” are very close to the information available in the “VMware vSphere API Reference” however there are some differences.
The list below is non-exhaustive:
Properties added like “LinkedView”,”Client” etc
“synchronous” functions insted of just the “asynchronous” Example for ClusterComputeResource: “ReconfigureCluster” and “ReconfigureCluster_Task”

One script, two functions:
This script can be used in two way with two different functions, so you can select the one that is matching your needs.

The first one “Export-APIPropertiesRecursiveToXMLWithoutDuplicates” is the fastest.
If one object has already been analysed previously the script will not attempt to identify all properties associated to this object again.

The other “Export-APIPropertiesRecursiveToXMLWithDuplicates” will export all properties of every objects even if this object has already been analysed in another branch.
One exception however, to avoid infinite loop, if an object has already been analysed in its own “parent” branch, properties will not be exported again.

The script:
Export-APIPropertiesRecursiveToXML.ps1

Example of files generated:
(Right click and select “save link as”)
API_ComputeResource.xml
Generated with:

$FullnameOfTheObjectToAnalyse =  "VMware.Vim.ComputeResource"
Export-APIPropertiesRecursiveToXMLWithoutDuplicates -ObjectToAnalyse $InitialObjectToAnalyse -IgnoreNestedObjectForInitialObject $True

API_VirtualEthernetCard.xml
Generated with:

$FullnameOfTheObjectToAnalyse =  "VMware.Vim.VirtualEthernetCard"
Export-APIPropertiesRecursiveToXMLWithDuplicates -ObjectToAnalyse $InitialObjectToAnalyse -IgnoreNestedObjectForInitialObject $False

Example of code generated in PowerCli prompt:
This code will be used in a another script.
For example for “VMware.Vim.VirtualEthernetCard” the first lines will be:

'AddressType',`
'AllowGuestControl',`
'Backing',`
'BackingObjectId',`
'ChangeId',`
'ChoiceInfo',`
'CompatibilityMode',`
'Connectable',`

Filed Under: PowerCLI, PowerShell, VMware

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Connect with me

  • LinkedIn

Featured Credentials

Latest News

  • Onyku® at Norwegian VMUG 19 May 2025
  • NCM-MCI exam tips
  • Open Knowledge Diagrams with Mermaid and Git
  • Start of a journey
  • Banned from Lego – customer review