Skip to content

Instantly share code, notes, and snippets.

@milnak
milnak / GuidGen.ps1
Last active April 1, 2025 22:44
PowerShell version of "GuidGen" application
param (
[ValidateSet('Ole', 'Define', 'Struct', 'Registry', 'AttributeBracket', 'AttributeBrace')]
[Parameter(Mandatory = $true, Position = 0)][string]$Type
)
function New-GuidObject {
$guid = (New-Guid).Guid
$m = Select-String `
-InputObject $guid `
-Pattern '([0-9A-Fa-f]{8})-([0-9A-Fa-f]{4})-([0-9A-Fa-f]{4})-([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})-([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})'
[PSCustomObject]@{