We can do bat, vbscript, perl etc as a run script action but if you want to run a PowerShell script then you need to run one action to create the script, one to run PowerShell then another to cleanup the script you copied down.
Powershell has become so prevalent on Windows devices that a specific bundle action type seems justified. Or extend the run script action...
by: Chad G. | over a year ago | Application Mgmt
Comments
I couldn't agree more!!
A Powershell support would be nice.
Chad: We are using powershell a lot but we don't create script files.
What we are doing in bundles is:
Add a "Run Script". The script is a normal .bat where we put the word "powershell" in the front of every powershell command.
For example:
powershell Set-ExecutionPolicy Bypass
powershell ....
powershell Set-ExecutionPolicy Restricted
This works fine with Windows 10...
What I do for my powershell scripts that I deploy via ZENworks is I create an (install/launch) action of type Run Script.
I define my own script, paste in my powershell script into the script contents, and give it an extension of .ps1.
The tricks I use to get it to run on every machine, regardless of the execution policy, is this: I set the Path to Script Engine to "${WINDIR}\System32\WindowsPowerShell\v1.0\powershell.exe" and then parameters for the script engine to "-ExecutionPolicy Bypass"
Also make all ZMAN functions available via powershell natively and support Windows Server Core.
This is how I run Powershell from ZENworks :-
Action Type : Run Script
Script Content : Your PS Script.
Script file extention : .ps1 (NOTE:You just type this in.)
Path to script Engine : %comspec%
Script Engine Parameters: /c C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe -executionpolicy unrestricted
(NOTE : Script Engine Parameters MUST HAVE a space at the end.)
https://shaundunmall.wordpress.com/to-run-a-powershell-script-from-zenworks/
+1 for embracing Powershell. Not only on Windows, but on Linux and Mac too.
I agree. And add network credentials option to launch script action in bundles as it is in launch executable
Please add this!!!
I'm now using powershell quite heavily on Windows and Mac.