Hello LucD,
I didn't want to open a new threat as is the same topic.
I would like to get the same output with some more information, a VM with Numcpu, memoryGB, a custom attribute + the vmdk attached to the VM and their corresponding datastore.
I have code for the 1st part, but I do not know how can I add the get-harddisk | select-object filename, capacityGB to the $report and concatenate the result,
Any hint would be appreciated, thank you.
Get-VM -name "*name*" | ForEach-Object {
$VM = $_
$VM | Get-Annotation -CustomAttribute "Roles"|`
ForEach-Object {
$Report = "" | Select-Object VM,Value,NumCpu,MemoryGB
$Report.VM = $VM.Name
$Report.NumCpu = $VM.NumCpu
$Report.MemoryGB = $VM.MemoryGB
$Report.Value = $_.Value
$Report
}
}