locked
Looking for Help with Active Directory Script to Remove a User from msExchDelegateListLink RRS feed

  • Question

  • I'm struggling to put together an Active Directory Powershell script that will remove a specific user from the msExchDelegateListLink.

    It looks like Set-AdUser would do the trick. I would want to remove a user in the format of

    {CN=Wood\, Sandy,OU=Networking,OU=IT,DC=my,DC=domain,DC=com}

    Has anyone succeeded in doing this before?


    Orange County District Attorney

    Monday, March 9, 2015 10:31 PM

Answers

  • I use this:

    $user = '<user name>'
    $userDN = Get-ADUser $user | select -ExpandProperty DistinguishedName
    
    $delegates = Get-ADUser $user -Properties msExchDelegateListBL |
     select -ExpandProperty msExchDelegateListBL
    
    foreach ($delegate in $delegates) 
     {
       Set-ADUser $delegate -Remove @{msExchDelegateListLink = "$UserDN"}
     }
    Never quite got around to putting it into a function.


    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "


    • Edited by mjolinor Tuesday, March 10, 2015 2:44 PM
    • Marked as answer by Sandy Wood Tuesday, March 10, 2015 2:57 PM
    Tuesday, March 10, 2015 2:43 PM

All replies

  • That is not really a scripting question:

    See: http://www.slipstick.com/exchange/removing-managed-mailboxes-from-an-outlook-profile/


    ¯\_(ツ)_/¯

    Monday, March 9, 2015 11:15 PM
  • I realize that but I was hoping to find a quicker alternative than firing up adsiedit every time. I'm guessing from your answer it's not possible?

    Orange County District Attorney

    Tuesday, March 10, 2015 2:12 PM
  • I use this:

    $user = '<user name>'
    $userDN = Get-ADUser $user | select -ExpandProperty DistinguishedName
    
    $delegates = Get-ADUser $user -Properties msExchDelegateListBL |
     select -ExpandProperty msExchDelegateListBL
    
    foreach ($delegate in $delegates) 
     {
       Set-ADUser $delegate -Remove @{msExchDelegateListLink = "$UserDN"}
     }
    Never quite got around to putting it into a function.


    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "


    • Edited by mjolinor Tuesday, March 10, 2015 2:44 PM
    • Marked as answer by Sandy Wood Tuesday, March 10, 2015 2:57 PM
    Tuesday, March 10, 2015 2:43 PM
  • Thanks! This gives me what I need to get started.

    Orange County District Attorney

    Tuesday, March 10, 2015 2:57 PM