SCCM install error 0x1(1), -ExecutionPolicy Bypass has been specified

Eaven HUANG 2,191 Reputation points
2022-04-28T09:16:32.99+00:00

Dear Experts,

I'm deploying an application via SCCM and specified

"%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy Bypass -Command ".\Wim_Installation_Cleanup.ps1"

However In Software Center when trying to install the app, it showed 0x1(1) and in logs it also said Unmatched exit code (1) is considered an execution failure.

I referred to https://www.prajwaldesai.com/microsoft-edge-deployment-error-unmatched-exit-code-1/ and changed -Command to -File "Wim_Installation_Cleanup.ps1"
That didn't make any difference.

Please help.
Thanks a lot!

Microsoft Security | Intune | Configuration Manager | Other
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Jason Sandys 31,411 Reputation points Microsoft Employee Moderator
    2022-04-28T16:00:46.893+00:00

    Do you have an execution policy assigned and enforced via policy (Intune or Group Policy)? If so, you can't override this locally.

    Also, even if you don't, bypassing the execution policy is a terrible idea and practice. All PowerShell scripts should be signed and you should absolutely be enforcing the All Signed execution policy as well as PowerShell constrained mode.

    1 person found this answer helpful.
    0 comments No comments

  2. Garth 5,801 Reputation points
    2022-04-28T14:34:17.143+00:00

    Did you test your script using the local system account? https://www.recastsoftware.com/resources/how-to-access-the-local-system-account/

    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.