How to change Postal Address of AD Users Using PowerShell

When AD users change office, their postal addresses become incorrect and you need to change them. As you know this can be inefficient and hectic if you change postal address of each user one by one using active directory users and computer ADUC MMC snap-in. In such scenarios, PowerShell is the preferred choice. So Let's get started changing AD user postal addresses with the help of PowerShell.

Change Postal Address of AD Users Using PowerShell

Step 1. Open PowerShell ISE with elevated privileges.

Step 2. Copy, paste the following script and execute it (Make sure to replace the values).

$users = Get-ADUser -SearchBase "OU=Branch Users,dc=yourdomain,dc=com" -Filter *

foreach ($user in $users) {

Set-ADUser $user.samaccountname -city "new city" -country "new country" -POBox "New PObox" -Postalcode "new postal code" -State "new state" -streetaddress "new street address"

}

 

Leave a Comment