Kace2000 powershell post install script
I am trying to run powershell scripts as post installation tasks on the kace 2000.
I add the scripts as applications and give the folowing parameters
powershell.exe -nologo -executionpolicy bypass -WindowStyle hidden -noprofile -file "script.ps1"
The above comes from this: http://www.itninja.com/question/how-to-run-a-powershell-command
During installation all the task will fail, and by examining the xml file i see the problem is the path where the command is run.
The path is something like c:\kace\task_name\powershell.exe and it should be C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
I tried to add this to the parameters like this:
"C:\Windows\System32\WindowsPowershell\v1.0\powershell.exe" -nologo -executionpolicy bypass -WindowStyle hidden -noprofile -file "script.ps1"
But this just gave the following path in the XML file
How should this be fixed?
Answer Chosen by the Author
I have found the most reliable method is to create a zip archive that contains the ps1 file and a batch script. The batch script just runs powershell. I then call the batch script as the parameter for the post-install task.