# encoding: ascii
# api: powershell
# title: Product Code to GUID
# description: If you’re a developer, installation packager or a ConfigMgr admin this script can be used to convert a product code to a GUID. This comes in handy when reverse engineering product installations.
# version: 0.1
# author: Adam Bertram
# license: CC0
# x-poshcode-id: 4687
# x-archived: 2013-12-13T12:18:35
# x-published: 2013-12-11T03:12:00
#
#
$string_indexes = [ordered]@{0=8;8=4;12=4;16=2;18=2;20=2;22=2;24=2;26=2;28=2;30=2}
$productcode = '1234567890123456789012345678901234'
foreach ($index in $string_indexes.GetEnumerator()) {
$part = $productcode.Substring($index.Key,$index.Value).ToCharArray()
[array]::Reverse($part)
$part -join ''
}