Powershell and script-exec - extension problem

1,118 views
Skip to first unread message

Alex Honor

unread,
Aug 19, 2014, 2:19:39 PM8/19/14
to rundeck...@googlegroups.com
Forwarding this as it was accidentally moved to spam.


From: "Miodrag Milić" <miodra...@gmail.com>
To: rundeck...@googlegroups.com
Cc: 
Date: Tue, 19 Aug 2014 10:19:17 -0700 (PDT)
Subject: Powershell and script-exec - extension problem
Using interpreter prefix I add to script-exec the following:

    powershell -Noprofile -File

This is what I get in the output

Processing -File 'D:\Downloads\rundeck\var\tmp\dispatch7415413838460298179.tmp.bat' failed because the file does not have a '.ps1' extension. Specify a valid Windows PowerShell script file name, and then try again.

There is no way that powershell will accept anything other then .ps1 and since we deal with interpreter as a prefix, there is no way to fix it the other ways.

I suggest to allow configuration of this extension or provide better mechanism for custom interpreter, the one that will allow for more precision in placement alike to printf.

To fix this problem I either have to 

- not use script-exec but script-file which is not the same thing
- use some cmd.exe wrapper script which is noisy 

BTW, it would be good to support powershell for executing commands and script files and scripts by default on Windows, since, cmd is outdated 10 years ago.

didier ernotte

unread,
Apr 29, 2015, 6:22:08 PM4/29/15
to rundeck...@googlegroups.com
The workaround I found was to "force" the interpreter like this :
- for a powershell script, the parameter "scriptInterpreter" should be "copy ${scriptfile} ${scriptfile}.ps1 & powershell -file ${scriptfile}.ps1 $ del ${scriptfile}.ps1.  This line should be urlencoded.
- for a python script, same thing :  ${scriptfile} ${scriptfile}.py & python ${scriptfile}.py $ del ${scriptfile}.py
etc

It is not elegant, but it works.   
A job has the file extension attribute, an adhoc script does not, it should. 

Grégory Roger

unread,
May 11, 2015, 9:23:12 AM5/11/15
to rundeck...@googlegroups.com
Hi,

When i use the execute remote command job, the extension parameter work nice and the file with the extension is create.
But when i use script file or URL to copy a script from a repository to the node, it don't work and the extension keep always .bat.

Best regard's
Gregory

François Villain

unread,
May 11, 2015, 9:23:12 AM5/11/15
to rundeck...@googlegroups.com
I opened an issue about this exact topic on their github bug tracker : https://github.com/rundeck/rundeck/issues/1225 

gangadhar r

unread,
Apr 1, 2017, 3:27:04 AM4/1/17
to rundeck-discuss
Hi didier,

I have used the scriptinterpreter as work around fro this still have the same issue. Any recommendation to resolve this issue

Logs:
[stub] copy local file to node DEV-ERPSVCS2: C:\WINDOWS\TEMP\23-502-DEV-ERPSVCS2-dispatch8892040946046495384.tmp.bat
The system cannot find the file specified.
The argument 'C:\WINDOWS\TEMP\23-502-DEV-ERPSVCS2-dispatch8892040946046495384.tmp.bat.ps1' to the -File parameter does not exist. Provide the path to an existing '.ps1' file as an argument to the -File parameter.
[overthere-winrm:DEV-ERPSVCS2] failed: exit code: -1
Could Not Find C:\WINDOWS\TEMP\23-502-DEV-ERPSVCS2-dispatch8892040946046495384.tmp.bat
Failed: NonZeroResultCode: [overthere-winrm] result code: -1

gangadhar r

unread,
Apr 1, 2017, 3:27:04 AM4/1/17
to rundeck-discuss
Hi didier,

I have used the scriptinterpreter as work around fro this still have the same issue. Any recommendation to resolve this issue?

Logs:
[stub] copy local file to node DEV-ERPSVCS2: C:\WINDOWS\TEMP\23-502-DEV-ERPSVCS2-dispatch8892040946046495384.tmp.bat
The system cannot find the file specified.
The argument 'C:\WINDOWS\TEMP\23-502-DEV-ERPSVCS2-dispatch8892040946046495384.tmp.bat.ps1' to the -File parameter does not exist. Provide the path to an existing '.ps1' file as an argument to the -File parameter.
[overthere-winrm:DEV-ERPSVCS2] failed: exit code: -1
Could Not Find C:\WINDOWS\TEMP\23-502-DEV-ERPSVCS2-dispatch8892040946046495384.tmp.bat
Failed: NonZeroResultCode: [overthere-winrm] result code: -1


On Wednesday, April 29, 2015 at 3:22:08 PM UTC-7, didier ernotte wrote:
Reply all
Reply to author
Forward
0 new messages