title: vSphere Powercli - The specified privileges are from a different server
body: <p>I have the following powercli script to add a local account to an esx host. 
  With all my research I believe this should work but when I run it I get this error.</p>
  
  <pre><code>    New-VIRole : 3/04/2014 9:23:49 a.m.    New-VIRole        The specified privileges are from a different server.    
  At .\test.ps1:18 char:11
  + New-VIRole &lt;&lt;&lt;&lt;  -Name "CIM Only" -Privilege "CIM interaction" 
      + CategoryInfo          : InvalidArgument: (VMware.VimAutom...ent.Privilege[]:Privilege[]) [New-VIRole], VimException
      + FullyQualifiedErrorId : Core_NewVIRole_DoWork_PrivilegeFromDifferentServerSpecified,VMware.VimAutomation.ViCore.Cmdlets.Commands.PermissionManagement.NewVIRole`
  </code></pre>
  
  <p>Here is the script</p>
  
  <pre><code>## As usual, load needed PowerCLI cmdlets  
  asnp VMware.VimAutomation.Core -ErrorAction SilentlyContinue      
  
  # Define the ESXi server  
  $server = "servername"    
  
  #Connect to ESXi server  
  Connect-VIServer -Server $server -user user -password password  
  
  #Create a new role CIM, with the only needed privilege assigned to it  
  New-VIRole -Name "CIM Only" -Privilege "CIM interaction" 
  
  #Create the cimuser account, assign it to root group, and deny it shell access  
  New-VMHostAccount -Id cimuser -Password password -UserAccount:$true -AssignGroups root -GrantShellAccess:$false
  
  #Assign the role CIM to the newly created cimuser account  
  New-VIPermission -Entity $server -Principal cimuser -Role "CIM Only" 
  
  #Disconnect from ESXi server  
  Disconnect-VIServer -Server $server -Confirm:$false 
  </code></pre>
  
  <p>Any help greatly appreciated.</p>