Run Powershell script as administrator in SCCM Package

Jason Steeves 121 Reputation points

I have a powershell script that is functioning correctly but when I package it into SCCM and run it on my test machines it's failing. This has been tested and if the script is run "as administrator" then it works fine.........if I manually run with normal credentials then that's when it gives me the error. This is failing even if I set the sccm package to run as administrator.

Please advise how I can get this powershell script to "Run As Administrator".

Microsoft Configuration Manager
0 comments No comments
{count} votes

6 answers

Sort by: Most helpful
  1. Amandayou-MSFT 10,956 Reputation points

    Hi @Jason Steeves ,

    When we deploy the package by sccm, it uses the system computer account. To narrow down the problem, we could use PSTools to test if the problem is related with SCCM, which uses system computer account.

    Here is the download link about PSTools:

    Please run the script using system account, refer to this following screenshot:


    If the response 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

  2. Garth 5,001 Reputation points MVP

    You need to find out why it is failing. You can do this but adding logging to your script or running it interactively. It could also be an x86 issue too. This blog gives more details.

    0 comments No comments

  3. Jason Steeves 121 Reputation points

    I created the sccm package to run the cmd as the local system account and when I run the powershell script I'm getting the error below. Any idea why this error is happening?


    0 comments No comments

  4. Garth Jones 1,301 Reputation points

    No idea, If I had to guess it is an x86 issue based on what you have said. But at least you have something to troubleshoot.

    0 comments No comments

  5. Jason Steeves 121 Reputation points

    what I'm doing is trying to add a SCOM server into the SCOM client and this is working via powershell and vbscript if I run the scripts with "Run As Administrator" privileges.............but as soon as I launch this from a regular command prompt then it fails.

    0 comments No comments