From a previous thread from dkaur I was trying out the following code:
my $host = Vim::find_entity_view(view_type => 'HostSystem');
my $this_permission = Permission->new(
principal => 'eccuser',
group => 'false',
roleId => '-2',
propagate => 'false');
my @permissions = ($this_permission);
my $auth_mgr = Vim::get_view(mo_ref => Vim::get_service_content() -> authorizationManager);
print "Name " . $host->name . "\n";
$auth_mgr->SetEntityPermissions(entity => $host, permission => @permissions);
This is targeted at a host (not VC) using the following parameters: myscriptname.pl --server remotehost
I get the following error:
SOAP Fault:
Fault string: A specified parameter was not correct.
entity
Fault detail:
$VAR1 = bless( {
'invalidProperty' => 'entity'
}, 'InvalidArgument' );
Reading the documentation for setEntityPermissions it says something about not being able to do this?
From the reference guide..
...This will fail with an InvalidArgument fault if called on: the direct child folders of a datacenter managed object, the root resource pool of a ComputeResource or ClusterComputeResource, or a HostSystem that is part of a ComputeResource (Stand-alone Host). These objects always have the same permissions as their parent...
Is there a way to do this or am I doing this incorrectly.
All I want to do is assign a user account on an ESX host a permission of read-only on that host object.