Book Image

Learning PowerCLI for VMware VSphere

By : Robert van den Nieuwendijk
Book Image

Learning PowerCLI for VMware VSphere

By: Robert van den Nieuwendijk

Overview of this book

Table of Contents (17 chapters)
Learning PowerCLI
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using raw API objects with ExtensionData or Get-View


PowerCLI makes it easy to use the VMware vSphere application programming interface (API). There are two ways to do this. The first one is by using the ExtensionData property that most of the PowerCLI objects have. The Extensiondata property is a direct link to the vSphere API object related to the PowerCLI object. The second way is by using the Get-View cmdlet to retrieve the vSphere API object related to a PowerCLI object. Both these ways will be discussed in the following sections.

Using the ExtensionData property

Most PowerCLI objects, such as VirtualMachineImpl and VMHostImpl, have a property called ExtensionData. This property is a reference to a view of a VMware vSphere object as described in the "VMware vSphere API Reference Documentation". For example, the ExtensionData property of the PowerCLI's VirtualMachineImpl object links to a vSphere VirtualMachine object view. ExtensionData is a very powerful property because it allows you...