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”
    WScript.Quit
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”
    WScript.Quit
End if

‘ Populate the XSL transform

Set oXSL = CreateObject(“MSXML2.DOMDocument”)

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

‘ 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. Anonymous says:

    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. 😉

    Thanks,

    Dan

  6. Anonymous 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:
    http://showboxandroids.com/showbox-apk/
    http://showboxappandroid.com/
    Latest version of Showbox App download for all android smart phones and tablets.
    http://movieboxappdownloads.com/ – 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:
    http://showboxappk.com/showbox-for-ipad-download/
    http://showboxappk.com/showbox-for-iphone/
    Showbox for PC articles:
    http://showboxandroids.com/showbox-for-pc/
    http://showboxappandroid.com/showbox-for-pc-download/
    http://showboxforpcs.com/
    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.

    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Komunikasi
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Listrik
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Management%20Trainee
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Manajemen
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Marketing
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Mekanik
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Mesin
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Metro%20TV
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Negeri
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Online
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Online%20Terbaru
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Oto
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Otomotif
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Pegawai%20Negeri
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Pendidikan
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Penerbangan
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Perawat
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Perikanan
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Perkapalan
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Perpustakaan
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Persero
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Pertamina
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Pertanian
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Peternakan
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Polisi
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Polwan

  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.