After upgrading to 3.6 for the K2000 we started having issues with the Task Engine and post install tasks that use a .cmd file. There's a KB article on how to modify post install tasks to work with the new Task Engine, but this didn't seem to be the issue we were having. I opened a case with support and they determined that there is a bug with that Task Engine and .cmd files. I also noticed this issue occurring with one BAT script post install task as well (a .bat file generated by the K2000, not a file I uploaded). Support's work around was to either add "CMD /C" or the path of the task (Y:\applications\[task id]\) before the call to the .cmd file (add contents\ if the file is in a zip). Since we have a few tasks across two different K2000s that weren't working, I came up with a VBScript that modifies Tasks.xml to workaround the bug. It's run as our first mid-level (post install task in the PE) task:
Set objXMLDoc = CreateObject("Msxml2.DOMDocument") objXMLDoc.async = False
strTasksFile = "X:\KACE\engine\Tasks.xml" If Not objXMLDoc.load(strTasksFile) <> 0 Then
WScript.Echo "There was an error loading Tasks.xml"
WScript.Quit
End If Set objXMLRoot = objXMLDoc.DocumentElement
For Each Task In objXMLRoot.SelectNodes("//Task")
Set CommandLine = Task.SelectSingleNode("./CommandLine")
If Right(CommandLine.Text, 3) = "cmd" Or Right(CommandLine.Text, 3) = "bat" Then
Set FileType = Task.SelectSingleNode("./FileType")
FileType.Text = "Batch"
End If
Next objXMLDoc.save(strTasksFile)
This script works by loading the Task Engine's Tasks.xml file and looping through to find any task that calls a .cmd or .bat file. If found it sets the FileType node to Batch (from Exe) as this seems to be what causes an error.
I just thought I'd share this on the chance it's useful.
Don't understand why these both aren't in the 3.6, they have some pretty clever guys (Corey), so if I can think of this stuff, I'm sure they can! - AJStevens 10 years ago