deactivated user
Using Exchange 2007 When adding user's rights for a user to distribution group, I sometimes get an error message because of a deactivated user present in the current list. Do you know any way to remove deactivated user who has been deactivated but has still rights in a distribution group by using shell command ??
June 5th, 2009 1:54pm

Hi, You can use the powershell command to find the list of disabled users. As you already have the list of users. Use can use the below mentioned command to find the active users list Get-Content "C\Names.txt " | Get-QADUser -enabled. More detail description of the command can be found in my blog. http://smtpport25.wordpress.com/2009/04/15/activeroles-quest-management-powershell-to-check-user-account-active-or-disabled/ http://smtpport25.wordpress.com/?s=disabled+
Free Windows Admin Tool Kit Click here and download it now
June 6th, 2009 6:33am

Hi,Thank you very much for you input. But in fact, it doesn't answer my question. I would need to find out how to remove deactivated users that already have right in a distribution group.Therefore, I need to remove deactivated users from the "Message Delivery Restrictions"/"Accept message from" option.Otherwise, I got an error message telling me that I cannot add a user's right as a deactivate useris prensent in the list of the "Accept message from".
June 8th, 2009 2:15pm

Hi,I guess deleting your deactivated users will help to fix this issue. user above command to get the list ofBelow is the powershell command to get the list of mailboxes which are in disable state and modified time is older then 10 daysGet-Mailbox -ResultSize unlimited |?{$_.useraccountcontrol -match "AccountDisabled, NormalAccount"} |?{$_.WhenChanged -lt (get-date).AddDays(-10)} |Remove-Mailboxhttp://smtpport25.wordpress.com/2009/06/01/delete-exchange-mailbox-and-ad-account-for-the-give-list-of-users/ Be carefull when you use to command. May test it in lab onceI hope i answered your questionRegards,Krishnahttp://smtpport25.wordpress.com
Free Windows Admin Tool Kit Click here and download it now
June 9th, 2009 6:21pm

Hi, Can you give an example of what you are trying to do and exact error message what you are getting? So I can simulate the situation in lab and can find cmdlet to do required things... :) Amit Tank | MVP Exchange Server | MCITP: EMA | MCSA: M | http://ExchangeShare.WordPress.com
June 9th, 2009 7:37pm

Ok, I understood the scenario after asking and managed to write a small script for you. As always suggest you to test this in lab first, since it will be going to update all DG in your environment... :) $Groups = Get-DistributionGroup -ResultSize Unlimited foreach ($group in $groups) { $AllAMOF = $group.AcceptMessagesOnlyFrom $SetLater = $group.AcceptMessagesOnlyFrom foreach ($AMOF in $AllAMOF) { $usr = Get-User $AMOF If($usr.recipienttype -eq "User") { $SetLater -= $usr.distinguishedname } } Set-DistributionGroup $Group -AcceptMessagesOnlyFrom $SetLater } Let me know if you need explanation on how this works... Amit Tank | MVP Exchange Server | MCITP: EMA | MCSA: M | http://ExchangeShare.WordPress.com
Free Windows Admin Tool Kit Click here and download it now
June 9th, 2009 9:12pm

Thanks you Amit!! as I do not have a test environnement.Could you tell me how ot run that command for only one distribuion list?
June 11th, 2009 10:45am

~ You can create couple of test groups like test1, test2... and change the first line of script like this... $Groups = Get-DistributionGroup -ResultSize Unlimited Test* OR ~ Second option is specify any single distribution list by giving exact name in first line of script... $Groups = Get-DistributionGroup -ResultSize Unlimited "Group Name" Amit Tank | MVP Exchange Server | MCITP: EMA | MCSA: M | http://ExchangeShare.WordPress.com
Free Windows Admin Tool Kit Click here and download it now
June 11th, 2009 10:53am

Last thing it would remove deactivate users only from the Distribution list. Am I correct?
June 11th, 2009 11:02am

Yes, deactivated users from"Message Delivery Restrictions"/"Accept message from" option. Actually deactivated users don't have mailbox associated so their recipient type is just User so this script will remove all users whose recipient type is User.Amit Tank | MVP Exchange Server | MCITP: EMA | MCSA: M | http://ExchangeShare.WordPress.com
Free Windows Admin Tool Kit Click here and download it now
June 11th, 2009 11:04am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics