VMware Cloud Community
AGFlora
Enthusiast
Enthusiast
Jump to solution

All blue folders do not show in report

Hi

For some reason or another when I run a report against one of my datacenters 2 blue folders do not show up in the report that are listed under this datacenter.

I'm attaching the code becasue this forum doesn't like brackets.

Thanks

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Yes, that's possible. Try the attached script.


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

View solution in original post

Reply
0 Kudos
8 Replies
LucD
Leadership
Leadership
Jump to solution

Your attached script starts from the permissions.

If a folder is not listed that could mean that there are no explicit permissions on that folder.

Is that perhaps the case for the two missing folders ?

You could go for a script that lists all the folders and then shows the permissions (implicit and/or inherited) for that folder.

Something like the attached script.

With the $inherited variable you can define if inherited permissions should be reported or not.

Note that the script will not list permissions that are assigned on other entities (like for example guests).


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

Reply
0 Kudos
AGFlora
Enthusiast
Enthusiast
Jump to solution

The permissions are inherited. They ae defined in the Vcenter server. Is there a way to modify this script to report on only one datacenter?

Thanks

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Try replacing this line (at the end of my script)

Get-Folder -Name "Datacenters" | Get-View | %{Get-Children $_ "" $inherited}

by this line

Get-Datacenter -Name "MyDatacenter" | Get-View | %{Get-View $_.VmFolder} | %{Get-Children $_ "MyDatacenter" $inherited}

You have to replace "MyDatacenter" with your datacentername twice.


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

AGFlora
Enthusiast
Enthusiast
Jump to solution

Luc

The permissions are propigated down from an ESX server. Could we add a Defined In column?

Thanks

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Yes, that's possible. Try the attached script.


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

Reply
0 Kudos
AGFlora
Enthusiast
Enthusiast
Jump to solution

Works great!

I have 2 questions:

1. How come in the report it says Defined In "datacenter" instead of the actual server name?

2. How come when I use $Report instead of $global:report I get a bank csv file?

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

1) Because internally the permissions defined at the top are assigned to the "hidden" folder called Datacenters and not to an individual ESX server in that datacenter. If you define a permission on an ESX server it will show the server.

2) That is due to the scope of PS variables. In the script I needed a variable that was visible inside the function and also in the outer level.

By adding the $global: prefix you make a variable visible in all the scope levels.

See Tobias's explanation (which is much better than mine) in Scope of Variables


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

AGFlora
Enthusiast
Enthusiast
Jump to solution

Thanks Luc... You're the best!

Reply
0 Kudos