Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

set-aduser zip code for bulk users

$
0
0

i try to update the zip-code for active directory users as the below 

# Import AD Module             
Import-Module ActiveDirectory 
$users = Import-Csv -Path C:\zip.csv
# Loop through CSV and update users if the exist in CVS file            
foreach ($user in $users) {
Get-ADUser -Filter "SamAccountName -eq '$($user.Username)'" 
Set-ADUser -PostalCode $($user.zipcode)
}


Ahmed Zidan Network Administrator


Viewing all articles
Browse latest Browse all 21975

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>