Tuesday, March 13, 2012

PowerCLI - Get-Member - Get all properties of an object

Get-VM | Get-Member -MemberType property | Format-Table -Property Name

Name
----
CDDrives
CustomFields
DatastoreIdList
Description
DrsAutomationLevel
ExtensionData
FloppyDrives
Folder
FolderId
Guest
HAIsolationResponse
HardDisks
HARestartPriority
Host
HostId
Id
MemoryMB
Name
NetworkAdapters
Notes
NumCpu
PersistentId
PowerState
ProvisionedSpaceGB
ResourcePool
ResourcePoolId
Uid
UsbDevices
UsedSpaceGB
VApp
Version
VMHost
VMHostId
VMResourceConfiguration
VMSwapfilePolicy

In this example, we can enhance the Get-VM output to show just the properties we are interested in:

Get-VM | Format-List -Property Name,Version


Name    : w2k8_vcenter_1
Version : v7

Name    : NTNX-Ctrl-VM-1-perses
Version : v7

Name    : NTNX_vMA
Version : v4

Name    : laura-ubuntu
Version : v8

Name    : NTNX-Ctrl-VM-2-perses
Version : v7

Name    : NTNX-Ctrl-VM-3-perses
Version : v7

No comments:

Post a Comment