Cant get Powershell Command to Run as Action


I have a Powershell Command that i want to run on some machines as an Action Item. The command runs fine if you run it directly on the computer. And yes, the c:\MSPHOTO exists with the appropriate files.

$Path = ‘C:\MSPHOTO’;Get-Childitem $Path -filter *.appx| %{Add-AppxPackage -Path $.FullName};;Get-Childitem $Path -filter *.appxbundle | %{Add-AppxPackage -Path $.FullName}

But it fails when it runs in BigFix

runhidden powershell.exe -ExecutionPolicy Bypass -Command “$Path = ‘C:\MSPHOTO’;Get-Childitem $Path -filter *.appx| %{Add-AppxPackage -Path $.FullName};;Get-Childitem $Path -filter *.appxbundle | %{Add-AppxPackage -Path $.FullName}”

If i run if through FixletDebugger I get "Relevence clauses must be surounded by { and } guwards. I made some tweaks here and there but no luck.

Any suggestions? Thanks

You have to escape curlybrackets, see Tip: Escaping curly brackets for substitutions in ActionScript

Or, change the script type from Action Script to PowerShell (which you can’t do in the Debugger), and use just direct PowerShell I’m the action (no Relevance substitutions though)

1 Like

Thanks Jason,

Unfortunately we’re on a older version of BigFix, 9.5 so we dont have direct Powershell

Managed to add {{ in certain areas and the script runs as completed/successful, even though nothing is actually happening. After a bit more troubleshooting (PSEXEC) is looks like it cant run those commands as Local System.

I have a workaround though which is a bit manual, but it works.

1 Like

If I’m not mistaken, Add-AppxPackage by default only installs for the current user. I think it may take a -AllUsers parameter to install to all accounts?