I\'m using powershell to modify some AD extensionattribute.
This is my code to add an extensionattribute
Set-ADUser -Identity \"anyUser\" -Add @{exte
I used the following today - It works!
Add a value to an extensionAttribute
$ThisUser = Get-ADUser -Identity $User -Properties extensionAttribute1
Set-ADUser –Identity $ThisUser -add @{"extensionattribute1"="MyString"}
Remove a value from an extensionAttribute
$ThisUser = Get-ADUser -Identity $User -Properties extensionAttribute1
Set-ADUser –Identity $ThisUser -Clear "extensionattribute1"
To clear the value you can always reset it to $Null. For example:
Set-Mailbox -Identity "username" -CustomAttribute1 $Null
You could try using the -Clear
parameter
Example:-Clear Attribute1LDAPDisplayName, Attribute2LDAPDisplayName
http://technet.microsoft.com/en-us/library/ee617215.aspx
Or the -Remove parameter
Set-ADUser -Identity anyUser -Remove @{extensionAttribute4="myString"}
Set-ADUser -Identity anyUser -Replace @{extensionAttribute4="myString"}
This is also usefull
Extension attributes are added by Exchange. According to this Technet article something like this should work:
Set-Mailbox -Identity "anyUser" -ExtensionCustomAttribute4 @{Remove="myString"}