12 Replies Latest reply on Oct 2, 2018 3:02 AM by Crobo

    Assign Permissions to host only in vcenter

    zimms Novice

      I have vcenter with several clusters. I am wanting to assign read-only permissions at the host level on a per cluster basis so as to provide limited access in vcenter.  The script I have below is what I am having an issue with. Why is this not working?


      $mycluster = Read-Host -prompt "Enter cluster name"

      $clusterhosts = Get-Cluster $mycluster | Get-VMhost


      foreach ($myhost in $clusterhosts) {

           New-VIPermission -Entity $myhost.name -Principal "domain\group" -Role "Read-only" -Propagate:$true




      The error I get is this:

      New-VIPermission : 1/8/2018 3:44:36 PM  New-VIPermission            Value cannot be null.

      Parameter name: collection

      At C:\Scripts\Vmware\Permissions\storage_team.ps1:7 char:1

      + New-VIPermission -Entity $myhost.name -Principal "domain\group ...

      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

      + CategoryInfo      : NotSpecified: (:) [New-VIPermission], VimException
      + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.PermissionManagement.NewVIPermission