Sorting MDT’s lists of applications, task sequences, patches, etc.

It seems to be a common request:  You want the MDT Deployment Wizard to show items sorted alphabetically.  So here’s a simple script to do that:

‘ First parameter:  XML file name
‘ Second parameter: name of the element to sort on, e.g. Name (case-sensitive)

If WScript.Arguments.Count <> 2 then
    WScript.Echo “Usage: cscript.exe SortXML.vbs <filename> <node to sort on>”
    WScript.Echo “Sample: cscript.exe SortXML.vbs C:\Distribution\Control\Applications.xml Name”
End if

‘ First load the specified XML file
Set oXML = CreateObject(“MSXML2.DOMDocument”)
oXML.PreserveWhiteSpace = true
oXML.Async = false
If not oXML.Load(WScript.Arguments(0)) then
    WScript.Echo “Unable to load XML file ” & WScript.Arguments(0) & “, aborting”
End if

‘ Populate the XSL transform

Set oXSL = CreateObject(“MSXML2.DOMDocument”)

oXSL.loadXML “<xsl:stylesheet version=””1.0″” xmlns:xsl=”””” >” & _
    ”    <xsl:template match=””@*|node()””><xsl:copy><xsl:apply-templates select=””@*|node()””><xsl:sort select=””” & WScript.Arguments(1) & “”” /></xsl:apply-templates></xsl:copy></xsl:template>” & _

‘ Transform the XML and save it back

oXML.transformNodeToObject oXSL, oXML
oXML.Save WScript.Arguments(0)

Save this as “SortXML.vbs” and then you can do things like this (substituting appropriate paths for your environment):

cscript.exe SortXML.vbs C:\Distribution\Control\Applications.xml FullName

cscript.exe SortXML.vbs C:\Distribution\Control\TaskSequences.xml Name

cscript.exe SortXML.vbs C:\Distribution\Control\Drivers.xml Name

For safety, make sure you have a backup copy of the file before you do this.  And don’t do this while the Deployment Workbench is running, as it could overwrite your sorted file.

Comments (9)
  1. Anonymous says:

    got it working as suggested – thanks.

  2. Yes, you can create a task sequence using the "custom" task sequence template that does this.  The only limitation:  If you need to perform any reboots, this custom task sequence (initiated from the full OS by mapping a drive to the deployment share and running LiteTouch.vbs) doesn’t set up the autologon or startup group entries necessary to resume the task sequence, so you’d have to run LiteTouch.wsf again manually or add an additional step to set up the machine to do autologon.

  3. Anonymous says:

    During deployment we can present the user with options to install applications.  Is it possible to be able to call that list of applications dialog post deployment.  We heard from clients it would be nice to be able for someone to call a script to bring that up again to install other apps later if they wanted to.

  4. Anonymous says:

    What if I just want the dialog up for the user that shows the list of apps to install after MDT has finished?

  5. Anonymous says:

    I would like to request that this feature be added to MDT 2010 Update 1. 😉



  6. Konrad says:

    Thank you for the script.  It is quite helpful.

  7. showbox says:

    Thanks for the great info. I really loved this. I would like to apprentice at the same time as you amend your web site, how could i subscribe for a blog site?
    For more info on showbox please refer below sites:
    Latest version of Showbox App download for all android smart phones and tablets. – It’s just 2 MB file you can easily get it on your android device without much trouble. Showbox app was well designed application for android to watch movies and TV shows, Cartoons and many more such things on your smartphone.
    For showbox on iOS (iPhone/iPad), please read below articles:
    Showbox for PC articles:
    There are countless for PC clients as it is essentially easy to understand, simple to introduce, gives continuous administration, effectively reasonable. it is accessible at completely free of expense i.e., there will be no establishment charges and after establishment
    it doesn’t charge cash for watching films and recordings. Not simply watching, it likewise offers alternative to download recordings and motion pictures. The accompanying are the strides that are to be taken after to introduce Showbox application on Android.
    The above all else thing to be done is, go to the Security Settings on your Android telephone, Scroll down and tap on ‘Obscure sources’.

  8. aw says:

    hai, I just want to tell you that I am just very new to blogs and seriously loved this website. More than likely I’m planning to bookmark your blog post .
    You amazingly come with really good posts. Thanks a lot for sharing your blog Microsoft.

  9. RT says:

    I can’t get this script work. First it was copy-pasting weird characters from the HTML, now it errors out at oXML.transformNodeToObject. Is there a newer version? I see some recent comments on this thread–perhaps it is popular all of a sudden?

Comments are closed.

Skip to main content