Hi Guys,
I have prepare the following smalls scripts:
$vcvm = (get-vm -location "xxxCluster").Name
$tag = Get-TagAssignment -Entity $vcvm | Where {$_.tag -notlike "*Information*" }
$VMowner= (Get-vm -name $vcvm).CustomFields | where {$_.key -like "VM Owner" }
I would like to get a simple table that shows VM Name, tag of VM and VM Owner vaule of VM as well,
Can you assist?, should I use on Array here?
I would use calculated properties on a Select-Object.
Something like this
Select Name,
@{N='Tag';E={(Get-TagAssignment -Entity $_ | where{$_.Tag.Name -notlike "*Information*"}).Tag.Name -join '|'}},
@{N='Owner';E={($_.CustomFields | where {$_.key -like "VM Owner" }).Value}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I would use calculated properties on a Select-Object.
Something like this
Select Name,
@{N='Tag';E={(Get-TagAssignment -Entity $_ | where{$_.Tag.Name -notlike "*Information*"}).Tag.Name -join '|'}},
@{N='Owner';E={($_.CustomFields | where {$_.key -like "VM Owner" }).Value}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference