Import-Module ActiveDirectory $users = $i = $null $users = Get-ADUser -filter * -property StreetAddress ForEach($user in $users) { if([string]::isNullOrEmpty($user.StreetAddress)) { "modifying $($user.name)" Set-ADUser -Identity $user.distinguishedName -StreetAddress "1600 Pennsylvania Ave NW" $i++ } }
This could be used to modify any of the Active Directory attributes by simply editing the -property being queried.
No comments:
Post a Comment