Hello All
question: i need a cmd to list the below information for a vm
vm name | vmhost | cluster | vcenter | storagepolicy | compliancestatus
i have two separate cmds fetching me this, but i need help in making this as a single cmd so that i can export-csv the same
cmd_1, get-vm|select name, vmhost, @{n='Cluster';e={$_.VMhost.Parent}}, @{n='vCenter';e={(($_.uid -split ":") -split "@")[1]}}
cmd_2, Get-SpbmEntityConfiguration| select name, StoragePolicy, ComplianceStatus
much appreciated
You could do something like this
Get-VM -PipelineVariable vm |
Get-SpbmEntityConfiguration |
Select @{N='Name';E={$vm.Name}},
@{N='VMHost';E={$vm.VMHost.Name}},
@{N='Cluster';E={$vm.VMhost.Parent.Name}},
@{N='vCenter';E={(($vm.uid -split ":") -split "@")[1]}},
@{N='SpbmName';E={$_.name}}, StoragePolicy, ComplianceStatus |
Export-Csv -Path .\report.csv -NoTypeInformation -UseCulture
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you !!
perfect, worked exactly, thanks LucD