From bc97219e5eb2fbc51cf7ddb9008039ccedbc7e54 Mon Sep 17 00:00:00 2001 From: Kawawete Date: Wed, 27 Nov 2024 17:44:55 +0100 Subject: [PATCH] Add script that generates random strings, useful for passwords --- Intune/Random-PWGen.ps1 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Intune/Random-PWGen.ps1 diff --git a/Intune/Random-PWGen.ps1 b/Intune/Random-PWGen.ps1 new file mode 100644 index 0000000..a2bab87 --- /dev/null +++ b/Intune/Random-PWGen.ps1 @@ -0,0 +1,15 @@ +$TokenSet = @{ + U = [Char[]]'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + L = [Char[]]'abcdefghijklmnopqrstuvwxyz' + N = [Char[]]'0123456789' + S = [Char[]]'!"#$%&''()*+,-./:;<=>?@[\]^_`{|}~' +} + +$Upper = Get-Random -Count 5 -InputObject $TokenSet.U +$Lower = Get-Random -Count 5 -InputObject $TokenSet.L +$Number = Get-Random -Count 5 -InputObject $TokenSet.N +$Special = Get-Random -Count 5 -InputObject $TokenSet.S + +$StringSet = $Upper + $Lower + $Number + $Special + +(Get-Random -Count 15 -InputObject $StringSet) -join '' \ No newline at end of file