PowerCLI commands to manage VMs

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

  1. To Open VM Console: Get-VM VMName | Open-VMConsoleWindow
  2. To get VM Properterties : Get-VM | Get-Member -MemberType property | Format-Table -Property Name
  3. To set browser for VM Console:
  4. Set-PowerCLIConfiguration –VMConsoleWindowBrowser “C:\Program Files (x86)\Mozilla Firefox\firefox.exe#To set the browser
  5. Set-PowerCLIConfiguration –VMConsoleWindowBrowser “$null#To clear above setting
  6. Get-HardDisk -VM Output like this: CapacityGB Persistence Filename

Appendix - Command outputs:
Output:
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:
Example : Get-VM | Format-List -Property Name,Version


Name    : w2k8_vcenter_1
Version : v7

Comments

Popular posts from this blog

vRA/vRO workflows

How to generate HPS Report for Windows