Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

PowerShell Step not working anymore

To preface, I had a working package that just ran a PowerShell script remotely on Win10 devices. It worked up until a few weeks ago. I think it may have to do with PDQ Deploy not supporting PS v1, but I'm not sure how to force it (via the custom command line) to run it in a different version.

This script does run just fine if ran locally on the machine. It is just through PDQ Deploy that I can no longer get it to work, so I think it may be a command line issue that I need to address. Essentially the script is to remove some of the Microsoft Default apps (i.e. Get-AppxPackage xboxapp | Remove-AppxPackage)

Original command line: %systemroot%\System32\WindowsPowerShell\V1.0\PowerShell.exe -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass

I've tried this: PowerShell.exe -Version 2 -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass It gives me "Successful" but it did not actually run the script.

I've also tried this: PowerShell.exe -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass It gives me an Error code 1: ScriptHalted At C:\WINDOWS\AdminArsenal\PDQDeployRunner\service-1\exec\Error Handling Wrapper.ps1:47 char:2

  • Throw $_.Exception.ErrorRecord
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    

Any help/suggestions would be much appreciated.

-Dayna

0

Comments

2 comments
Date Votes
    1. Are you running this in a Command, PowerShell, or Install step?
    2. Are you using Deploy 17.2.0.0?
    0
  • It was a PowerShell step. Tried on both a 17.1.0.0 and a 17.2.0.0 version. What ended up being the problem was we had " Set-ExecutionPolicy Unrestricted " (& then Restricted at the end of script) which had worked previously but made it stop working after late April for some reason. Once we removed that code the script worked again.

    Thanks!

    0