How to run a powershell script?

Hi,
I would like to execute a ps1 file and I added the following command in Deploy-Application.ps1

Execute-Process -FilePath “$PSHOME\powershell.exe” -Parameters “-ExecutionPolicy bypass”, “-File $dirSupportFiles\CreateScheduledTask.ps1”

But it doesn’t execute to file.
Any ideas what I am doing wrong?

Your parameters syntax is incorrect. Anyway, it is preferable in my opinion to dot-source your external script. This keeps things in the same thread.

image

Note there is a space after the dot. I like to include these in Files/ along with payload if possible. If you find yourself dot-sourcing something regularly, it may be a time saver to write as a function and add as an extension to the toolkit in AppDeployToolkitExtensions.ps1.

You first need to run the AppDeployToolkitMain.ps1 to load all the functions. Then you can manually execute that one line you want. I assume this is for testing and monitoring