Update accounts with new Logon Script

Find all accounts with a specific logon scripts and update them.

 

$adusers = Get-QADUser -SizeLimit 0 | Where-Object {$_.logonscript -eq "login_test.bat"}

#count users that have this logon script

#$adusers | Measure-Object

ForEach ($user in $adusers )

{

   Write-Host "Changeing logon script for user" $user.SamAccountName, "from" $user.logonscript "to login.bat"

   #Set-QADUser $user.DN  -logonscript "login.bat"

}