VMware Cloud Community
TimReidCA
Contributor
Contributor

Using Get-Compliance run in script with a service account

We have failed to determine the proper rights required for a service account to run a script to report on ESX Patch levels using Get-Compliance.  We made an attempt to add all VUM rights in a vSphere group that our service account is a member of, in addition to some read-only rights.  The Get-Compliance will not work in this way.  I am forced to ask the VMware administrator to run this script.

Does anybody have a list of rights that can be applied to a read-only service account to run Get-Compliance from a PowerCLI script?

This is an example of the security error that I am getting with the service account.

Get-Compliance : 11/6/2012 2:30:55 PM    Get-Compliance        fault.SecurityError.summary
At C:\vmware\ESX_Patch_Host_V5_stakd.ps1:125 char:53
+                 foreach($baseline in (Get-Compliance <<<<  -Entity $esx -Detailed))
    + CategoryInfo          : NotSpecified: (:) [Get-Compliance], VimException
    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VumAutomation.Commands.GetCompliance

Thank you

Tim 

0 Kudos
2 Replies
TimReidCA
Contributor
Contributor

I guess I stumped the band.

We have resolved this issue, details forthcoming.  As soon as I get the details from the administrator I will post them.

T. Reid 

0 Kudos
tmithilesh
Contributor
Contributor

$comStatus2 = Get-Compliance -Entity $Cluster -Baseline $NonCriticalBaseline -ComplianceStatus Compliant
if($comstatus2.Status -like "Compliant")

for the above line i am getting this error. Please help me on.

Get-Compliance : 5/18/2022 7:56:37 PM Get-Compliance
fault.SecurityError.summary
At C:\vmwtest\work\vum\VMware-testware\vmqa\scripts\new3.ps1:38 char:17
+ ... omStatus2 = Get-Compliance -Entity $Cluster -Baseline $NonCriticalBas ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-Compliance], VimException
+ FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VumAutomatio
n.Commands.GetCompliance

Get-Compliance : 5/18/2022 7:56:37 PM Get-Compliance
fault.SecurityError.summary
At C:\vmwtest\work\vum\VMware-testware\vmqa\scripts\new3.ps1:38 char:17
+ ... omStatus2 = Get-Compliance -Entity $Cluster -Baseline $NonCriticalBas ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-Compliance], VimException
+ FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VumAutomatio
n.Commands.GetCompliance

0 Kudos