The Deployment Guys

Helping to deploy your world automagically...

Banish GUIDs from CustomSettings.ini in MDT

Banish GUIDs from CustomSettings.ini in MDT

  • Comments 1
  • Likes

Another of my pet peeves about MDT CustomSettings.ini rules is that fact that you have to define entries for Applications and ManditoryApplications as GUIDs.  Here is the example for Applications from the MDT help file:

[Settings]
Priority=Default

[Default]
Applications001={1D7DF331-47B7-472C-87B3-442597EC2F7D}
Applications002={9d2b8999-5e4d-4f3d-bb05-edaaf4fe5628}

In order to get the GUID for an application, you have to open the XML file which holds the Applications definitions - \<DeploymentShare>\Control\Applications.xml.  (Yes, the Deployment Workbench does display the GUID in the Applications list.  However, you cannot select the GUID to copy and paste it into CustomSettings.ini.)  When you open Applications.xml in a text editor the first thing you notice is that the contents of the file in all on a single line.

image

So now you are in for a bunch of scrolling right and hunting or turning on word wrap to find the GUID that you need.  You can alleviate this by first opening the XML file in XML Notepad (http://xmlnotepad.codeplex.com/) and then clicking Save.  This will “prettify” the XML making it easier to find entries like so:

image

 

However, wouldn’t it be nicer if we could just use the Name of the Applications instead of the GUIDs?

image

To that end I have created a User Exit script, MDTExitNameToGuid.vbs, that allows just that.  There are two main functions that allow it to be used in two different ways.  If you have a property or a small number of List Item entries, use the ConvertNameToGUID function.  Here is an example:

[Settings]
Priority=Default, NameToGuid
Properties=

[NameToGuid]
UserExit=MDTExitNameToGuid.vbs
Applications001=#ConvertNameToGUID("Contoso Application A 1.0", "Applications")#
Applications002=#ConvertNameToGUID("Contoso Application B 2.0", "Applications")#

The parameters for the ConvertNameToGUID function are (<Item Name in Deployment Workbench>, <Control folder XML file base name>).

If you have more than one or two entries for a List Item (like Applications or ManditoryApplications), then using the ConvertNameToGUIDInList function is more efficient.  This converts all text entries in the List Item to their corresponding GUIDs (and logs if no matching GUID is found for any entries).  Here is an example:

[Settings]
Priority=Default, NameToGuid
Properties=ConvertList

[NameToGuid]
UserExit=MDTExitNameToGuid.vbs
Applications001=Contoso Application A 1.0
Applications002=Contoso Application B 2.0
ConvertList=#ConvertNameToGUIDInList("Applications", "Applications")#

The parameters for the ConvertNameToGUIDInList function are (<List Item name>, <Control folder XML file base name>).

(Note: You can find a list of the MDT XML files in the Support Files topic in the MDT help file.)

 

Disclaimer: The information on this site is provided "AS IS" with no warranties, confers no rights, and is not supported by the authors or Microsoft Corporation. Use of included script samples are subject to the terms specified in the Terms of Use.

This post was contributed by Michael Murgolo, a Senior Consultant with Microsoft Services - U.S. East Region.

Attachment: MDTExitNameToGuid.zip
  • Actually, in the MDT workbench you can copy the GUID from the application. Just highlight the line on the properties page and press Ctrl+C - works just fine

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment