Powershell script deployment failuire

anthony raimondi 21 Reputation points

Hi Guys

I am trying to deploy a PowerShell script using SCCM package and I get the error code 0x1(1)

The log states Program failed with error code 1

If i deploy the script using SCCM Scripts it works perfectly

I am not sure why i get the error when deploying as a package

This is the command im using

"%Windir%\sysnative\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy Bypass -Command .\VDA Upgrade.ps1

Any help will be great

Microsoft Configuration Manager
0 comments No comments
{count} votes

Accepted answer
  1. Jason Sandys 31,146 Reputation points Microsoft Employee

    Error code 1 for PowerShell is typically due to the execution policy enforcing script signing. If your group policy enforces an execution policy, you cannot override this on the command line.

    Also, you don't want to use -command to execute a PowerShell script. -Command will just load the PowerShell script. You want to use -File to execute the script.

    1 person found this answer helpful.
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. anthony raimondi 21 Reputation points

    Thank you for the response Jason

    So it wont make a difference if I have set the PowerShell policy in SCCM Computer Agent client settings to bypass? GPO still would take precedent correct?

  2. anthony raimondi 21 Reputation points

    I think its working now. I changed to -File like you said and also took the sapce out on the PowerShell script name. I didn't have " " so maybe that why it failed?

    was ./VDA Upgrade.ps1 now its set to VDAUpgrade.ps1