locked
Removed Disabled accounts RRS feed

  • Question

  • Hi All,

    Firstly I'm no expert only being using exchange on my company's test environment for 1 day :)

    Scenario

    AD have disabled users and I would like to remove these disabled accounts in Exchange, because the disabled users are still appearing in the distribution groups. 

    Is there some way to filter out these disabled accounts in exchange, like we have the ability to add a filter to the user profile synchronization in sharepoint.

    Kind Regards 

    Monday, March 17, 2014 2:30 PM

Answers

  • You could run a powershell script in your AD and remove disabled users from any distribution groups. If this would work I can provide you the relevant script.

    Regards,

    Denis Cooper

    MCITP EA - MCT

    Help keep the forums tidy, if this has helped please mark it as an answer

    Blog: http://www.windows-support.co.uk  Twitter:   LinkedIn:

    Monday, March 17, 2014 3:44 PM
  • Easiest way to do this is do use the quest powershell tools which you can download free of charge from

    http://www.quest.com/powershell/activeroles-server.aspx

    then use this command from the Quest Powershell window (run as admin and from an account that has AD permissions to remove people from groups)

    $groups = Get-QADGroup -GroupType Distribution | foreach {
    	Get-QADGroupMember $_ -Disabled | Remove-QADGroupMember $_
    	}


    Regards,

    Denis Cooper

    MCITP EA - MCT

    Help keep the forums tidy, if this has helped please mark it as an answer

    Blog: http://www.windows-support.co.uk  Twitter:   LinkedIn:


    Tuesday, March 18, 2014 9:31 AM

All replies

  • You could run a powershell script in your AD and remove disabled users from any distribution groups. If this would work I can provide you the relevant script.

    Regards,

    Denis Cooper

    MCITP EA - MCT

    Help keep the forums tidy, if this has helped please mark it as an answer

    Blog: http://www.windows-support.co.uk  Twitter:   LinkedIn:

    Monday, March 17, 2014 3:44 PM
  • use powershell scripts to update user membership in AD.

    Regards, Riaz Javed Butt Consultant Microsoft Professional Services MCITP, MCITP (Exchange), MCSE: Messaging, MCITP Office 365

    Monday, March 17, 2014 4:00 PM
  • Thanks Denis,

    That would be ideal to be honest.

    Really appreciate that

    Regards 

    Monday, March 17, 2014 5:01 PM
  • Easiest way to do this is do use the quest powershell tools which you can download free of charge from

    http://www.quest.com/powershell/activeroles-server.aspx

    then use this command from the Quest Powershell window (run as admin and from an account that has AD permissions to remove people from groups)

    $groups = Get-QADGroup -GroupType Distribution | foreach {
    	Get-QADGroupMember $_ -Disabled | Remove-QADGroupMember $_
    	}


    Regards,

    Denis Cooper

    MCITP EA - MCT

    Help keep the forums tidy, if this has helped please mark it as an answer

    Blog: http://www.windows-support.co.uk  Twitter:   LinkedIn:


    Tuesday, March 18, 2014 9:31 AM
  • Thank you Denis,

    Would you run this in the AD server or Exchange server?

    Also do I need to change anything on the PS code?
    Tuesday, March 18, 2014 9:42 AM
  • I've removed the search scope part of the command as you don't need that. You should run it on a client workstation that you have the quest powershell tools installed on


    Regards,

    Denis Cooper

    MCITP EA - MCT

    Help keep the forums tidy, if this has helped please mark it as an answer

    Blog: http://www.windows-support.co.uk  Twitter:   LinkedIn:

    Tuesday, March 18, 2014 9:54 AM
  • Thank Denis,

    Sorry to ask another question, but do I need to use the quest powershell console?

    What about if I run it from the CMD window on the exchange server?

    Tuesday, March 18, 2014 9:59 AM
  • You need to run it from the quest tools

    Regards,

    Denis Cooper

    MCITP EA - MCT

    Help keep the forums tidy, if this has helped please mark it as an answer

    Blog: http://www.windows-support.co.uk  Twitter:   LinkedIn:

    Tuesday, March 18, 2014 10:04 AM
  • thanks Denis
    Tuesday, March 18, 2014 10:11 AM
  • Hi all, you can delete the particular user from the active directory and re create the user if u want the disabled user I tried in the AD and it worked
    Tuesday, March 18, 2014 10:18 AM
  • Hi all, you can delete the particular user from the active directory and re create the user if u want the disabled user I tried in the AD and it worked
    Tuesday, March 18, 2014 10:18 AM
  • Hi all,

    you can delete the particular user from the active directory and re create the user if u want the disabled user I tried in the AD and it worked 

    Tuesday, March 18, 2014 10:18 AM
  • Hi all,

    you can delete the particular user from the active directory and re create the user if u want the disabled user I tried in the AD and it worked 

    Tuesday, March 18, 2014 10:18 AM
  • Hi all,

    you can delete the particular user from the active directory and re create the user if u want the disabled user I tried in the AD and it worked 

    Tuesday, March 18, 2014 10:18 AM
  • Hi all, you can delete the particular user from the active directory and re create the user if u want the disabled user I tried in the AD and it worked
    Tuesday, March 18, 2014 10:19 AM
  • Hi all, you can delete the particular user from the active directory and re create the user if u want the disabled user I tried in the AD and it worked
    Tuesday, March 18, 2014 10:19 AM
  • Hey you keep posting the same thing and flooding the thread

    Regards,

    Denis Cooper

    MCITP EA - MCT

    Help keep the forums tidy, if this has helped please mark it as an answer

    Blog: http://www.windows-support.co.uk  Twitter:   LinkedIn:

    Tuesday, March 18, 2014 10:20 AM
  • Hi all, you can delete the particular user from the active directory and re create the user if u want the disabled user I tried in the AD and it worked
    Tuesday, March 18, 2014 10:20 AM