Set-ADUser for attribute that is NULL

This topic contains 2 replies, has 2 voices, and was last updated by  Jeff Taylor 1 month, 1 week ago.

  • Author
    Posts
  • #73093

    Jeff Taylor
    Participant

    How do I run Set-ADUser for a property (msExchRecipientDisplayType) that is currently set to NULL?

    Tried this:

    $users = Import-Csv -Path .\TestUsers.csv
    foreach ($user in $users) {                        
     Get-ADUser -Identity $($user.DN) -Properties msExchRecipientDisplayType -Server Domain.parent.com |            
      Set-ADUser -msExchRecipientDisplayType $($user.Value)
    }

    My error is:

    Set-ADUser : A parameter cannot be found that matches parameter name 'msExchRecipientDisplayType'.

    I thought I would have the parameter in the pipeline to set.

  • #73094

    Rob Simmers
    Participant

    Exchange Active Directory attributes should only be set with Exchange cmdlets.

    I'm not an Exchange SME, but my guess would be that those values are set when you do something like Enable-Mailbox for a user would associate the attribute with a User Mailbox. To reiterate (also by the first link), Exchange sets those values, they should not be directly modified

    • #74485

      Jeff Taylor
      Participant

      this worked:

      $users = import-csv 
      Foreach ($u in $users) {set-ADUser $u.DN -replace @{msexchrecipientdisplaytype="0"}

You must be logged in to reply to this topic.