I have a procedure that is supposed to run a tracert (and gather other basic diagnostic info) if another ping test fails. I have the procedure working but I'd like to add the time that the tracert was run, down to the minute. I have this all working in a batch file, but trying to build a procedure and figure out what Kaseya is expecting is quite difficult -- such as realizing the open bracket used to output to a file is two >> rather than just one >. Below is what I have so far. Unfortunately, it is creating the text file with %runtime% in the file name instead of the actual format I have set, which is var_trace_YEAR_MONTH_DAY_HOUR_MINUTE.txt.
I am using the "executeShellCommand" statement for all the below lines:
line 1 = set runtime=%date:~10,4%_%date:~4,2%_%date:~7,2%_%TIME:~0,2%_%TIME:~3,2%
line 2 = ipconfig /all >>"c:\"var_trace_%runtime%.txt""
line 3 = tracert mail.mydomainname.com >>>>"c:\"var_trace_%runtime%.txt""
line 4 = systeminfo >>>>"c:\"var_trace_%runtime%.txt""
Any ideas anyone??
Each line is executed in its own separate shell instance so the runtime variable is not seen by the other shell commands.
You can try Echo the time value to a text file and then use the Get Variable File Content to read the contents of the text file into a procedure variable instead.
I have attached a working example of how you would script what you are asking for without the need of any clunky batch files.
To me is sounds like the variables are not passing across the executeshellcommand. I would toss the commands into a BAT file and run that way.
Just call the bat file from your kaseya script.
So does the bat file need to be stored on each computer where the procedure will be run? Or, is there a way to "store" it in Kaseya? Can you explain how to use a bat instead? Would I just use the same "executeShellCommand" statement and just have the following(?):
Five stars for Mr. HardKnoX.