Video Screencast Help

How do I run PowerShell from the "Run this script" field in DS 6.9?

Created: 30 May 2012 • Updated: 05 Jun 2012 | 4 comments
This issue has been solved. See solution.

We're running DS 6.9 SP5 MR2, so PowerShell is natively supported. In a DS "Run Script" task, you can either run the script by selecting the script file or entering the script in the "Run this script" field. The only thing that works for me in the "Run this script" field is bat/cmd files. In this

connect posting, someone comments

For Run Script Dialog the user will have to use comment # Powershell somewhere in the script which is pretty similar to how VB Scripts that need to have the comment 'vbscript in them.

This doesn't work for me. As far as I can tell, the lines in the "Run this script" field are always parsed by CMD.EXE. Is PowerShell or VBS even supported in this field? It would be pretty cool to have a little section with "Choose the script parser: PowerShell.exe / cmd.exe / cscript.exe" with a radio button next to each.

It's annoying to have a job full of Run Script tasks with identical descriptions: "F:\Program Files(x86)\Altiris\eX..."


Comments 4 CommentsJump to latest comment

tester2k5's picture

Yes the (few other) other Script-Languages are supported as well.

Per default the script will be parsed by the Command Prompt.


But when you start your Script in this field with the first line:


It will be parsed by CSCRIPT.

And i assume that you need to start like this as well for PowerShell:


To run your PowerShell Script.





chi-user's picture

Yeah, 'vbscript did work for me. Dunno what I was doing wrong before. Thanks. #powershell must be all lowercase in order for the DS to send it to PowerShell.

symdon's picture

Please try below steps.........

1. Make sure that executionpolicy is set to unrestricted on client side which enables powershell script execution on client machine. Or Execute command “set-executionpolicy  unrestricted “ on client machine before executing powershell scripts through DS runscript task.

2.On Win32 console, Create a new "Run Script" job
3.Type the below powershell script in 'Run this script:" dialog
2 + 2 >> C:\test.txt 

4.Schedule this job on a client machine.
5. test.txt file should get created on client machine with 4 as output




chi-user's picture

The "p" in "#powershell" must be lower-case in order for it to work. I was using an upper-case "P".