Reset Passwords for users in a specific OU

Hi There

we have a new HR system that is using Powershell to Create users. Unfortunately, this does not output the passwords so we cannot send them to the managers.

Is there a way to reset the passwords for any users that get created in this OU using a generic password?

I have got a script that generates a password, I cant seem to get it to Reset the users password.

$Users = get-qaduser -SizeLimit 10000 -SearchRoot 'ou=new users,dc=test,dc=Local' -IncludedProperties DisplayName, SamAccountName

function Get-RandomPassword {
$length = 10
$characters = 'abcdefghkmnprstuvwxyzABCDEFGHKLMNPRSTUVWXYZ'
$nonchar = '123456789!$%&?#'
$random = 1..$length | ForEach-Object { Get-Random -Maximum $characters.length }
$random2 = 1..2 | ForEach-Object { Get-Random -Maximum $nonchar.length }
$private:ofs= ""
$ThePassword = [string]$characters[$random] + [string]$nonchar[$random2]
return $ThePassword
}

function Reset-ADPassword {
foreach ($User in $Users) {
$Username = $User.SamAccountName
$DisplayName = $User.DisplayName
$Password = Get-RandomPassword

Write-Host $DisplayName / $Username / $Password
Set-ADAccountPassword -id $username -NewPassword (ConvertTo-SecureString -AsPlainText $Password -Force)
}