Running a Powershell Script inside of a package

I have seen various topics on this here and none of the solutions are working for me. I am new to the Toolkit so what I am trying to do is in Pre Deployment run a script that copies an XML file to all user profiles in AppData. I tried running the direct powershell inside of Pre Deployment tasks and that did not work but the package installed. I assume that the tool can’t use variables created while running the tool, so I want to put it into a script and then call the script.

I have the script in Support files called CopyXML.ps1

In my Deploy-Application.ps1 I have this

Execute-Process -Path “$PSHOME\powershell.exe” -Parameters “-executionpolicy bypass -file $dirSupportFiles\CopyXML.ps1"

If I run it with that present it immediately fails. What am I missing here? I have tested running the script from command line outside of the deployment tool and it works fine.

I also tried this and got no error but it did not complete the copy task

& “$dirSupportFiles\CopyXML.ps1” -ExecutionPolicy Bypass

 Execute-Process -Path "powershell.exe" -Parameters "-Command & { & `"$dirFiles\<yyourps>.ps1`"; Exit `$LastExitCode }" -Wait