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
Get-VM “vmname” | Select *
That work?
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.
Define full? Get-VM should return this information
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.
Hi,
You could use some like that :
PS > get-vm -name MyVM | Get-VMGuest | select *
Thank you
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 } }
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.
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}}}