Reply to Message

View discussion in a popup

Replying to:
LucD
Leadership
Leadership

Try something like this

&{foreach($vm in Get-VM){
  Get-VIPermission -Entity $vm |
 
Select @{N="VM";E={$vm.Name}},*
}} | Export-Csv C:\report.csv -NoTypeInformation -UseCulture

This will include all the properties of the object coming from the Get-VIPermission cmdlet.

If you don't want certain properties in the report, you can do something like this

&{foreach($vm in Get-VM ){
  Get-VIPermission -Entity $vm |
  Select -ExcludeProperty EntityId,ExtensionData,Uid -Property @{N="VM";E={$vm.Name}},*
}}
| Export-Csv C:\report.csv -NoTypeInformation -UseCulture


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos