with PowerCLI 12.1 we get an error when we revert to a snapshot with Set-VM -Snapshot if the user has only permission to a vm or a folder with vms.
Connect-VIServer vcenter -User userA
$vm = Get-Vm "vm01"
$snapshot = Get-Snapshot -VM $vm -Name "tmp"
Set-Vm -VM $vm -Snapshot $snapshot -Confirm:$false
Set-Vm : 20.10.2020 08:08:08 Set-VM Failed to get Lookup Service information for this vCenter server. Details:
Permission to perform this operation was denied. Required privilege 'System.Read' on managed object with id
At line:1 char:1
+ Set-Vm -VM $vm -Snapshot $snapshot -Confirm:$false
+ CategoryInfo : InvalidOperation: (:) [Set-VM], VimException
+ FullyQualifiedErrorId : ViCore_ConnectivityServiceImpl_GetLookupServiceClient_NoClient,VMware.VimAutomation.ViCo
I have try it with PowerCLI 12.0 and didn’t get this error.
I have olso try it with PowerCLI 12.1 and an other user who has permissions on the level of vcenter and get no error.
Can please watch a PowerCLI developer in the code and try to fix this?