/build/static/layout/Breadcrumb_cap_w.png

K2000 3.6 Task Engine .cmd Bug

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.


Comments

  • Brilliant, thank you dummptyhummpty, this has saved me a lot of time and almost got my k2000 back working again, unfortunately the Task Engine doesn't like my wsname.exe command (grr) and I suspect all my reboot instructions won't work now and I'll have to use the new reboot required tick box, although MY code adds an autologin entry so you don't have to set the exact right number of autologins in the Setup Configuration.

    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
This post is locked

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ