Adding and removing extensionattribute to AD object

后端 未结 7 1362
春和景丽
春和景丽 2020-12-09 18:02

I\'m using powershell to modify some AD extensionattribute.

This is my code to add an extensionattribute

Set-ADUser -Identity \"anyUser\" -Add @{exte         


        
相关标签:
7条回答
  • 2020-12-09 18:25

    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" 
    
    0 讨论(0)
  • 2020-12-09 18:28

    To clear the value you can always reset it to $Null. For example:

    Set-Mailbox -Identity "username" -CustomAttribute1 $Null

    0 讨论(0)
  • 2020-12-09 18:38

    You could try using the -Clear parameter

    Example:-Clear Attribute1LDAPDisplayName, Attribute2LDAPDisplayName

    http://technet.microsoft.com/en-us/library/ee617215.aspx

    0 讨论(0)
  • 2020-12-09 18:39

    Or the -Remove parameter

    Set-ADUser -Identity anyUser -Remove @{extensionAttribute4="myString"}
    
    0 讨论(0)
  • 2020-12-09 18:39
    Set-ADUser -Identity anyUser -Replace @{extensionAttribute4="myString"}
    

    This is also usefull

    0 讨论(0)
  • 2020-12-09 18:42

    Extension attributes are added by Exchange. According to this Technet article something like this should work:

    Set-Mailbox -Identity "anyUser" -ExtensionCustomAttribute4 @{Remove="myString"}
    
    0 讨论(0)
提交回复
热议问题