PowerCLI commands to manage VMs
PowerCLI - Get-Member - Get all properties of an object
- To Open VM Console: Get-VM VMName | Open-VMConsoleWindow
- To get VM Properterties : Get-VM | Get-Member -MemberType property | Format-Table -Property Name
- To set browser for VM Console:
- Set-PowerCLIConfiguration –VMConsoleWindowBrowser “C:\Program Files (x86)\Mozilla Firefox\firefox.exe” #To set the browser
- Set-PowerCLIConfiguration –VMConsoleWindowBrowser “$null” #To clear above setting
- 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
- To Open VM Console: Get-VM VMName | Open-VMConsoleWindow
- To get VM Properterties : Get-VM | Get-Member -MemberType property | Format-Table -Property Name
- To set browser for VM Console:
- Set-PowerCLIConfiguration –VMConsoleWindowBrowser “C:\Program Files (x86)\Mozilla Firefox\firefox.exe” #To set the browser
- Set-PowerCLIConfiguration –VMConsoleWindowBrowser “$null” #To clear above setting
- 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
Post a Comment