Hi Maelito,
it could be done this way:
get-vm | Select Name,@{N="Configured OS";E={$_.ExtensionData.Config.GuestFullname}},@{N="Running OS";E={$_.Guest.OsFullName}}, @{N="disktype";E={(Get-Harddisk $_).Storageformat}}
(Configured OS it what you choose during the VM creating, Running OS is what is actually seen running by the VMware tools)
Tim
Hi Maelito,
it could be done this way:
get-vm | Select Name,@{N="Configured OS";E={$_.ExtensionData.Config.GuestFullname}},@{N="Running OS";E={$_.Guest.OsFullName}}, @{N="disktype";E={(Get-Harddisk $_).Storageformat}}
(Configured OS it what you choose during the VM creating, Running OS is what is actually seen running by the VMware tools)
Tim
Tim,
Brilliant, that is exactly what I need - Thanks! :smileycool:
For my personal development would be able to tell me where I would find those expressions?
@{N="Configured OS";E={$_.ExtensionData.Config.GuestFullname}},@{N="Running OS";E={$_.Guest.OsFullName}}, @{N="disktype";E={(Get-Harddisk $_).Storageformat}}
Maelito
Hi Maelito,
glad I could help.
You can for example do a
Get-VM | Get-Member
in the PowerCLI.
Or you look it up in the PowerCLI Reference, which is very nice: VirtualMachine
Tim
I looked it up and this is what I found out:
get-vm | where {$_.powerstate -eq "PoweredOn"} | Select Name,@{N="Configured OS";E={$_.ExtensionData.Config.GuestFullname}},@{N="Running OS";E={$_.Guest.OsFullName}}, @{N="disktype";E={(Get-Harddisk $_).Storageformat}} | Export-Csv .\DIsk-State.csv -NoTypeInformation -NoClobber
Get-VM test2008-01
Powerstate is a property
Name is a property
,@{N="Configured OS"; <<- Label on the CSV report
E={$_.ExtensionData.Config.GuestFullname}} <<- $vm = get-vm test2008-01
$vm.extensiondata.[tab tab tab and CONFIG is an option – GUESTFULLNAME is a PROPERTY]
@{N="Running OS";E={$_.Guest.OsFullName}}, <<- https://www.vmware.com/support/developer/PowerCLI/PowerCLI55R2/html/VirtualMachine.html
<<- $vm = get-vm test2008-01
$vm.guest[type “vm.” tab tab tab and GUEST is an option – OSFULLNAME is a PROPERTY]
@{N="disktype";E={(Get-Harddisk $_).Storageformat}} <<- get-harddisk test2008-01 | get-member
StorageFormat is a PROPERTY
During my google searches I came across Get-View command and everyone saying how fast it is... How can I have the same info but using get-view instead of get-vm?
Maelito
Hello Guys,
I hope you are doing well,
any way to add to this line a "get-annotation -customattribute "Roles " ? I could not find the way to concatenate the command...
get-vm -name "serversclients* "| Select Name,NumCpu,MemoryGB,@{N="VMDK";E={(Get-Harddisk $_).Filename}} ,@{N="SIZE";E={(Get-Harddisk $_).CapacityGB}} | Format-Table -AutoSize
...the idea is to get a list of VMs with the corresponding cpu, ram , vmdk per datastore and a specific annotation.
I've got an answer on another thread. thank you.