Razz007
Contributor
Contributor

Get-VIPermission for each VM in vCenter

Hi,

I am looking for a way to display the VIPermissions of each VM listed in vCenter without entering a command for each VM (as there are hundreds).

Here is what I would like to automate....

  1. Connect to my vCenter Connect-VIServer vcentername
  2. List all my VM's Get-VM | Format-Table Name
  3. List my permissions for each VM Get-VIPermission vmname

Here is the closest I've come to getting what I'm looking for accept my output file does not include the VM names accociated with the permissions.

Get-VM -Server esxhostname | ForEach-Object {Get-VIPermission -Server vcentername $_.name} | Export-Csv C:\temp\exportfile.csv

or

Get-VM | ForEach-Object {Get-VIPermission -Server vcentername $_.name} | Export-Csv C:\temp\exportfile.csv

Thanks in advance,

M

Reply
0 Kudos