rundeck-plugins / rundeck-winrm-plugin

Rundeck WinRM Node Executor plugin
Other
56 stars 28 forks source link

Command always executing with extra quotes on windows machine #32

Closed vvchik closed 9 years ago

vvchik commented 9 years ago

Hello All,

I have latest 2.5.3-1 version installed Also I installed winrm plugin and trying to run powershell command on remote windows computer. I need to run following command: powershell -command " &{(New-Object System.Net.WebClient).DownloadFile(http://10.0.0.5:8081/files/win2012r2std-1.vhdx, C:\VHDs\SOMEFOLDER\win2012r2std.vhdx)} "

then I trying to use following command powershell """& { (New-Object System.Net.WebClient).DownloadFile( 'http://10.10.10.20:80/files/win2012r2std-1.vhdx', 'C:\Users\test\111\Virtual Hard Disks\win2012r2std.vhdx' ) } """ everything works as documented

but i need to use several variables in that command

so if I trying to add them everything is going bad, some additional quotes comes and i unable to fix that

following example with only one variable code in job definition: powershell """& { (New-Object System.Net.WebClient).DownloadFile( 'http://10.10.10.20:80/files/win2012r2std-1.vhdx', 'C:\Users\test\${option.GuestName}\Virtual Hard Disks\win2012r2std.vhdx' ) } """

code that come in runtime: powershell '"& { (New-Object System.Net.WebClient).DownloadFile( '"'"'http://10.10.10.20:80/files/win2012r2std-1.vhdx'"'"', '"'"'C:\Users\test\${option.GuestName}\Virtual Hard Disks\win2012r2std.vhdx'"'"' ) } "'

I have tried all possible combinations of quoting styles from the documentation - at least I think so.

but without any success

vvchik commented 9 years ago

looks like it more rundeck itself problem, so i will open issue there