We can run shell commands from service desk anymore?
Did anyone else use this besides me? It was kind of critical to us.
Shell commands need to be configured via an XML file. Please see the Service Desk online help for details: help.kaseya.com/.../index.htm
You will need to place an xml file in the following folder
Note that existing commands should continue to work . it only becomes an issue if you try and edit one of them.
The other point to note is that the Help specifies the following format with outputvariable as Optional :
<shellCommandDef label="Shell Command 2" commandToExecute="echo hello" waitForCompletion="true" sendOutputToLog="true" outputFile="c:\temp\fromcmd2.log" outputVariable="" />
So 2 things to note
1) What I have found is that unless you specify a variable the command will fail
I've logged a ticket re this so it should get resolved , but in the interim just put some varname in as the outputVariable.
2) And if your command string needs to include any Double quotes
Echo “This is a test message”
you will need to format the actual command as :
Echo "This is a test message"
Thanks, I missed that memo.
That last post of mine wasn't so clear on what I meant by double quotes
You need to do this as per the attached image
My issue is that i can't find the folder directory C:\Kaseya\xml\SDProcShellCommand\0 .
should i create the directory manually or this is directory already exist?
I get the need to configure the xml to approve the script, but I cannot see any provision to pass a variable to the script. This seems like a fairly basic requirement but can anyone confirm if this is this possible? (And if so, how?)
Any variable you decare in the SD procedure , or any standard SD Ticket Variable can be usdcan be used
HEre I have decvalred 2 variables in my SD PRocedure [=starttime=] and [=endtime=] and have just used then in my xml as below.
<shellCommandDef label="GetTimeDiff" commandToExecute="cscript.exe //nologo c:\kworking\sdtime.vbs [=starttime=] [=endtime=]" waitForCompletion="true" sendOutputToLog="false" outputFile="" outputVariable="TimeDiff" />
The result of the above command is then returned as a new variable called "TimeDiff" which I can then use in the SD Procedure as either #TimeDiff# if being used in an IF statement , or as [=TimeDiff=] if using the actual value