Access denied when executing Invoke-CimMethod and Invoke-WMIMethod to run SCCM Client Actions

Willem-Jan Vroom 101 Reputation points
2021-01-15T06:18:24.82+00:00

Hello all,

I have created a script to run the SCCM Client Actions. I receive an 'access denied' when running as a standard user (non admin rights):

Script:

Clear-Host
$SCCMID = "{00000000-0000-0000-0000-000000000001}"
$params = @{
                            'Namespace'    = 'root\CCM'
                            'ClassName'    = 'SMS_Client'
                            'MethodName'   = 'TriggerSchedule'
                            'Arguments'    = @{ sScheduleID = $SCCMID }
                            }
Invoke-CimMethod @params 


Invoke-WMIMethod -Namespace root\ccm -Class SMS_CLIENT -Name TriggerSchedule $SCCMID

The output:

Invoke-CimMethod : Access denied
At line:9 char:1

  • Invoke-CimMethod @params
  • ~~~~~~~~~~~~~~~~~~~~~~~~
  • CategoryInfo : PermissionDenied: (root\CCM:SMS_Client:String) [Invoke-CimMethod], CimException
  • FullyQualifiedErrorId : HRESULT 0x80041003,Microsoft.Management.Infrastructure.CimCmdlets.InvokeCimMethodCommand

Invoke-WMIMethod : Access denied
At line:12 char:1

  • Invoke-WMIMethod -Namespace root\ccm -Class SMS_CLIENT -Name TriggerS ...
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • CategoryInfo : InvalidOperation: (:) [Invoke-WmiMethod], ManagementException
  • FullyQualifiedErrorId : InvokeWMIManagementException,Microsoft.PowerShell.Commands.InvokeWmiMethod

My question is: is there a way to run these commands as a regular - non admin - user? Feedback is appreciated.

With kind regards,
TheStingPilot

Windows for business | Windows Client for IT Pros | User experience | Other
0 comments No comments
{count} votes

Accepted answer
  1. Willem-Jan Vroom 101 Reputation points
    2021-01-22T09:48:53.493+00:00

    A new piece of code solved this issue:

    $CPApplet = New-Object -Comobject CPApplet.CPAppletMgr
    $Actions  = $CPApplet.GetClientActions()
    ForEach ($Action in $Actions)
     {
      $Action.PerformAction()
     }
    

    Thanks!

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. AliceYang-MSFT 2,106 Reputation points
    2021-01-18T03:31:24.417+00:00

    Hi,

    We think these commands cannot be run as a regular user. But you can post the issue in some third-party forums, users there may have a solution.

    Here are some of them

    Please note: Information posted in the given link is hosted by a third party. Microsoft does not guarantee the accuracy and effectiveness of information.

    ----------

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.