VMware Cloud Community
DanMan3395
Enthusiast
Enthusiast

Get FULL hardware configuration of a VM from powercli

I want to export the complete hardware configuration of a vm to the console via PowerCLI. Get-VM seems to only have limited information based on a Get-VM xxx | Get-Member check. In vCenter, if you right click on a vm and select "Edit Settings" you get a GUI based breakdown of the entire virtual hardware config of the VM. I want to output that exact information to the console.

Message was edited by: Daniel Ogden Grammar & spelling

8 Replies
ChrisFD2
VMware Employee
VMware Employee

Get-VM “vmname” | Select *

That work?

Regards,
Chris
VCIX-DCV 2023 | VCIX-NV 2023 | vExpert *** | CCNA R&S
Reply
0 Kudos
DanMan3395
Enthusiast
Enthusiast

No, unfortunately Get-VM doesn't seem to pull the full list of hardware API's, so even outputting its entire return to the console really doesn't have much if any hardware config info.

Reply
0 Kudos
sjesse
Leadership
Leadership

Define full? Get-VM should return this information

pastedImage_1.png

DanMan3395
Enthusiast
Enthusiast

Full meaning the same information provided by the "edit setting -> virtual hardware tab" in vcenter. That means cpu cores/sockets, ram, disk count, type, controller, etc, etc.

Reply
0 Kudos
Marmotte94
Enthusiast
Enthusiast

Hi,

You could use some like that :

PS > get-vm -name MyVM | Get-VMGuest | select *

Thank you

Please, visit my blog http://www.purplescreen.eu/
Reply
0 Kudos
sjesse
Leadership
Leadership

I don't have a script but some of those properties are arrays, like the hard disks you need to expand those as needed. I think some of the other ones are views in extensiondata.  If your familar with rest apis, it may be easier to grab the json file that the vcenter rest api can make. It returns a response like

{ "parallel_ports": {}, "cdroms": {}, "name": "string", "floppies": {}, "boot": { "enter_setup_mode": true, "retry": true, "efi_legacy_boot": true, "network_protocol": "IPV4", "delay": 0, "retry_delay": 0, "type": "BIOS" }, "disks": {}, "boot_devices": [ { "nic": "string", "disks": [ "string" ], "type": "CDROM" } ], "guest_OS": "DOS", "serial_ports": {}, "hardware": { "version": "VMX_03", "upgrade_status": "NONE", "upgrade_version": "VMX_03", "upgrade_policy": "NEVER" }, "nics": {}, "power_state": "POWERED_OFF", "memory": { "hot_add_increment_size_MiB": 0, "hot_add_enabled": true, "hot_add_limit_MiB": 0, "size_MiB": 0 }, "scsi_adapters": {}, "sata_adapters": {}, "cpu": { "count": 0, "hot_add_enabled": true, "hot_remove_enabled": true, "cores_per_socket": 0 } }

New vSphere 6.5 REST API and API Explorer

Reply
0 Kudos
DanMan3395
Enthusiast
Enthusiast

s my thought as well. It seems like to accomplish this, I will need to poke at the massive API library until I find everything and save it as a custom module. At my skill level, that will take a very long time.

Frankly I am not familiar enough with REST to know how to parse the output, assuming there is a RESTful API that specifically contains this information combination.

I think you are right though, thanks man.

Reply
0 Kudos
DanMan3395
Enthusiast
Enthusiast

Found the below script in an 8 year old post on this site. It does almost exactly what I am looking for. Question is, how do I get it to include cpu config info and memory config info in the table?

Get-VM -Name server123 | Get-View | ForEach-Object {

     $vm = $_

     $_.Config.Hardware.Device | Select @{N="VM name";E={$vm.Name}},@{N="HW name";E={$_.GetType().Name}},@{N="Label";E={$_.DeviceInfo.Label}}}

Reply
0 Kudos