Created
November 10, 2023 17:48
-
-
Save HarmonicHemispheres/d9a0113c0d902627ef9d791e14050aa3 to your computer and use it in GitHub Desktop.
Random GUID Pattern Generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
This script was written by Bing Chat. | |
This script generates a random string with the same length as the given GUID. | |
INSTRUCTIONS: | |
1. Replace the input variable with your own GUID. | |
2. Run the script. | |
DISCLAIMER: | |
This script is provided "AS IS" without warranty of any kind. | |
Bing Chat further disclaims all implied warranties including, without limitation, | |
any implied warranties of merchantability or of fitness for a particular purpose. | |
The entire risk arising out of the use or performance of the script remains with you. | |
#> | |
$input = "AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE" | |
$chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" | |
$result = "" | |
for ($i = 0; $i -lt $input.Length; $i++) { | |
if ($input[$i] -eq "-") { | |
$result += "-" | |
} else { | |
$result += $chars[(Get-Random -Minimum 0 -Maximum $chars.Length)] | |
} | |
} | |
Write-Output $result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment