Handy Active Directory examples for bulk operations

Basic “foreach” user operation

$users = Get-ADUser -Filter {(city -like "abc") -And (Enabled -eq $true) -And (company -NotLike "*abc")}
foreach ($user in $users) {
Set-ADUser $user.samaccountname -info "Lorem Ipsum"
}