Hola,
Te pongo un script que hace lo que necesitas, con la excepción de que está pensado para hacerlo sobre TODOS los usuarios de la OU que pongas. Si quisieras filtrar y hacerlo sobre los que cumplan algún requisito tendrás que añadir esa parte.
Aunque es posible hacerlo con Set-ADUser, el script lo monto con ADSI porque (al menos en mi caso) me da mucho mejor rendimiento cuando hay que hacer un cambio masivo.
$Error.Clear()
Clear-Host
$otherPagerValue = "excludeILM"
$DS = New-Object System.DirectoryServices.DirectorySearcher
$DS.PageSize = 15000
$DS.Filter = "(&(objectCategory=person)(objectCategory=User))"
$DS.SearchRoot = "LDAP://ou=subOU,ou=tu_ou,dc=tu_dominio,dc=tu_sufijo" #La OU donde están los usuarios que quieres cambiar
$ADUsers = $DS.FindAll()
ForEach ($User in $ADUsers)
{
$Props = $null
$Props = $User.Properties
$Username = $null
$Username = $Props.samaccountname
$DN = $null
$DN = $Props.distinguishedname
Write-Host -ForegroundColor DarkRed "Actualizando $Username con otherPage: $otherPagerValue"
Try
{
$UserDN = [ADSI] "LDAP://$DN"
$UserDN.psbase.invokeSet("otherPager",$otherPagerValue)
$UserDN.setinfo()
}
Catch
{
Write-Output $Error
}
}
Espero que te sirva.
Un saludo,
Diego