PoshCode Archive  Artifact [22c38376c7]

Artifact 22c38376c7dde177dfea79bcea891430fa18da2c39b2e183bdbeb5d24a0ad4b9:

  • File Product-Code-to-GUID.ps1 — part of check-in [42f135c149] at 2018-06-10 13:44:35 on branch trunk — 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. (user: Adam Bertram size: 758)

# 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 ''
}