From be71e00d990211292e1fb1508de2f48ab414f8a8 Mon Sep 17 00:00:00 2001 From: mjfernez Date: Thu, 16 Oct 2025 00:35:52 -0400 Subject: Add fixed AD scripts and discord stuff --- AD-powershell-tools/bulk-reset.ps1 | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 AD-powershell-tools/bulk-reset.ps1 (limited to 'AD-powershell-tools/bulk-reset.ps1') diff --git a/AD-powershell-tools/bulk-reset.ps1 b/AD-powershell-tools/bulk-reset.ps1 new file mode 100644 index 0000000..e66aad6 --- /dev/null +++ b/AD-powershell-tools/bulk-reset.ps1 @@ -0,0 +1,24 @@ +Import-Module ActiveDirectory + +function Gen-Random-Password { + $str = "" + for ($i = 0; $i -lt 24 ; $i++) { + $rand = Get-Random -Minimum 32 -Maximum 127 + $str += [char]$rand + } + $newpwd = ConvertTo-SecureString -String [String]$str -AsPlainText -Force + return $newpwd +} + +# Import users from CSV +$csv = Get-Content $args[0] + +ForEach ($user in $csv) { + $newPassword = Gen-Random-Password + + # Reset user password. + Set-ADAccountPassword -Identity $user -NewPassword $newPassword -Reset + + Write-Host $user"'s password has been reset" + Write-Host $newPassword +} -- cgit v1.2.3