Hello, I have a very weird problem with a PS script that runs fine elsewhere but not in RD anymore. It has been working fine for months (in RD) and now it throws weird errors:
At C:\WINDOWS\TEMP\36-10835-localhost-dispatch-script.tmp.ps1:45 char:3
+ td, th { border:1px solid black;
+ ~
Missing argument in parameter list.
At C:\WINDOWS\TEMP\36-10835-localhost-dispatch-script.tmp.ps1:49 char:6
+ table, tr, td, th { padding: 2px; margin: 0px }
+ ~
Missing argument in parameter list.
At C:\WINDOWS\TEMP\36-10835-localhost-dispatch-script.tmp.ps1:65 char:79
+ ... nvertTo-HTML -Head $head -Body $html.InnerXml -PostContent "<h6>Creat ...
+ ~
The '<' operator is reserved for future use.
At C:\WINDOWS\TEMP\36-10835-localhost-dispatch-script.tmp.ps1:65 char:91
+ ... Head $head -Body $html.InnerXml -PostContent "<h6>Created and Sent by ...
+ ~~~
Unexpected token 'and' in expression or statement.
At C:\WINDOWS\TEMP\36-10835-localhost-dispatch-script.tmp.ps1:65 char:124
+ ... Xml -PostContent "<h6>Created and Sent by Rundeck - $(Get-Date)</h6>"
+ ~
The '<' operator is reserved for future use.
At C:\WINDOWS\TEMP\36-10835-localhost-dispatch-script.tmp.ps1:81 char:82
+ ... or -Message "Connection from Rundeck Server to vCenter server failed"
+ ~
The string is missing the terminator: ".
At C:\WINDOWS\TEMP\36-10835-localhost-dispatch-script.tmp.ps1:54 char:9
+ .paused {color: #FF8000 }
+ ~
Missing closing '}' in statement block or type definition.
At C:\WINDOWS\TEMP\36-10835-localhost-dispatch-script.tmp.ps1:53 char:10
+ .pending {color: #DF01D7 }
+ ~
Missing closing '}' in statement block or type definition.
+ CategoryInfo : ParserError: (:) [], ParseException
+ FullyQualifiedErrorId : MissingArgument
Result: 1
Failed: NonZeroResultCode: Result code was 1
Execution failed: 10835 in project RSM-Tasks: [Workflow result: , step failures: {1=Dispatch failed on 1 nodes: [localhost: NonZeroResultCode: Result code was 1 + {dataContext=MultiDataContextImpl(map={ContextView(step:1, node:localhost)=BaseDataContext{{exec={exitCode=0}}}, ContextView(node:localhost)=BaseDataContext{{exec={exitCode=0}}}}, base=null)} ]}, Node failures: {localhost=[NonZeroResultCode: Result code was 1 + {dataContext=MultiDataContextImpl(map={ContextView(step:1, node:localhost)=BaseDataContext{{exec={exitCode=0}}}, ContextView(node:localhost)=BaseDataContext{{exec={exitCode=0}}}}, base=null)} ]}, status: failed]
the first line of errors refers to a block of code which is this:
$head = @"
<Title>$ReportTitle</Title>
<style>
body { background-color:#FFFFFF;
font-family:Tahoma;
font-size:12pt; }
td, th { border:1px solid black;
border-collapse:collapse; }
th { color:black;
background-color:#f7b359; }
table, tr, td, th { padding: 2px; margin: 0px }
table { width:95%;margin-left:5px; margin-bottom:20px;}
.stopped {color: Red }
.running {color: Green }
.pending {color: #DF01D7 }
.paused {color: #FF8000 }
.other {color: Black }
</style>
<br>
<H2>$ReportTitle</H2>
"@
if I copy the code in VS Code it works fine. I recreated the job from scratch but same problem. I don't get it!! Other jobs run fine... any hint? I also rebooted the server. It's a Rundeck4.17.02023-09-25basilisk sandybrown flag on Windows 2019