Windows Installer stores information about components, products, etc. that are installed on the system in the registry. Most of these elements are identified by a GUID, but the Installer doesn’t always store the GUID directly in the registry. Instead it uses what I call SQUIDs, or Squished GUIDs. Basically they just reformat the GUID a bit and remove some of the extra characters that don’t add anything (hyphens and braces). You can read more about this here: A Brief Note on Installer GUIDs.

Periodically when I am working on some installer code I can end up needing to search the registry for stuff that is related to a component I am working on. It is very helpful to be able to convert between SQUIDs and GUIDs. I usually just do this by hand, but today I decided I needed a bit more help doing this and wrote a tiny vbscript piece of code that does the conversion. On the chance that it might provide value for someone else, I have decided to post it here.

Function SquidToGuid(s) SquidToGuid = _ StrReverse(Mid(s, 1, 8)) & "-" & _ StrReverse(Mid(s, 9, 4)) & "-" & _ StrReverse(Mid(s, 13, 4)) & "-" & _ StrReverse(Mid(s, 17, 2)) & StrReverse(Mid(s, 19, 2)) & "-" & _ StrReverse(Mid(s, 21, 2)) & StrReverse(Mid(s, 23, 2)) & StrReverse(Mid(s, 25, 2)) & _ StrReverse(Mid(s, 27, 2)) & StrReverse(Mid(s, 29, 2)) & StrReverse(Mid(s, 31, 2)) End Function Function GuidToSquid(g) Replace g, "{", "" Replace g, "}", "" GuidToSquid = _ StrReverse(Mid(g, 1, 8)) & _ StrReverse(Mid(g, 10, 4)) & _ StrReverse(Mid(g, 15, 4)) & _ StrReverse(Mid(g, 20, 2)) & StrReverse(Mid(g, 22, 2)) & _ StrReverse(Mid(g, 25, 2)) & StrReverse(Mid(g, 27, 2)) & StrReverse(Mid(g, 29, 2)) & _ StrReverse(Mid(g, 31, 2)) & StrReverse(Mid(g, 33, 2)) & StrReverse(Mid(g, 35, 2)) End Function