Editing extensionattribute15 on a user with Powershell

We used to run Exchange (2003) internally, but no longer do. However we wanted to add a value to a user, where the user, and the value, were included in a CSV file. So if you want to add/modify a users extensionattribute with Powershell, this is how you can do it!


#Variables - edit as required
################################################################
$server = "gregdom.int"
$csvfile = "emea to groupid.csv"
################################################################

$userstrings = Import-Csv $csvfile

Foreach ($userstring in $userstrings) {
	$Username = $userstring.Username
	$Value = $userstring.ValuetoAdd

	$DN = (Get-adUser $username -Server $server).DistinguishedName
 	$User = [ADSI]"LDAP://$DN"
 	$User.Put("extensionAttribute15", $value)
 	$User.SetInfo()	
				
	}

Leave a comment

Filed under Uncategorized

Leave a comment