how to get vm permissions in vijava Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of how to get vm permissions in vijava without wasting too much if your time.

The question is published on by Tutorial Guruji team.

I’m trying to get permissions of virtual machine using vijava like this:

ManagedEntity me = new
InventoryNavigator(rootFolder).searchManagedEntity("VirtualMachine", vmName);
                VirtualMachine vm = (VirtualMachine) me;
for (Permission permission : vm.getPermission()) {

With this I get permissions applied only for This vm.

How can I get total permissions on virtual machine including inherited?


To get all inherited permissions you should get all parents permissions like this:

  while (me.getParent() != null) {
        me = me.getParent();
        Permission[] permissions = me.getPermission();
        if (permissions != null) {
            for (Permission p : permissions) {
                // do stuff....
We are here to answer your question about how to get vm permissions in vijava - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji