functions/function-New-LHGUID.ps1
function New-LHGUID { <# .SYNOPSIS Creates a new GUID .DESCRIPTION Creates one or more GUID's in different color to easier differentiate between them. .Parameter Count .EXAMPLE New-LHGUID Writes one new GUID to the screen. .EXAMPLE New-LHGUID -Count 4 Writes four new GUID's to the screen. #> [CmdletBinding()] param ( $Count = 1 ) for ($i=0; $i -lt $Count; $i++){ $max = [System.ConsoleColor].GetFields().Count - 1 $color = [System.ConsoleColor](Get-Random -Min 1 -Max $max) $header = "[$($i+1)] " $guid = (New-Guid).Guid $arrGuids += @("$header $guid") Write-Host -BackgroundColor Black $header -NoNewline Write-Host -BackgroundColor Black -ForegroundColor $color $guid } return $arrGuids } |