Showing posts with label Exchange Management Shell. Show all posts
Showing posts with label Exchange Management Shell. Show all posts

Tuesday, August 9, 2011

Emails stuck in submissions queue–Exchange 2010 sp1

While checking the message queue on a hub transport server I found many messages stuck with status retry and last error read something like the following

 400 4.4.7 The server responded with: 550 5.6.0 CAT.InvalidContent.Exception: InvalidCharsetException, Character set name (ISO-8859-6-i) is invalid or not installed.; cannot handle content of message with InternalId….

I always like to have the mail queue clear and specially submission (local deliveries), which can be a nightmare if clogged.

Resolution

by looking at the details of these messages one could tell that they are either spam of Exchange server cannot process it because the FromAddress field is <> empty.

to get rid of these messages from the queue, I just used the following cmdlet.

Get-Message -Filter {FromAddress -eq "<>"} -Server htserver | Remove-Message

Friday, July 8, 2011

Upgrade All Distribution Lists to Exchange 2010

To make use of Exchange 2010 distribution list features and make way to decommission your legacy servers upgrade you all your distribution lists to Exchange 2010 by running the following cmdlet

Get-DistributionGroup –ResultSize Unlimited | Set-DistributionGroup –ForceUpgrade

In Exchange 2010 management of distribution lists has changed a little due to exchange design. To manage permissions of who can edit membership of members of a group and who can manage groups see the following post.

http://mykbit.blogspot.com/2011/07/how-to-manage-distribution-lists-with.html

How to manage Distribution Lists with groups in Exchange 2010

Issue

When User1 tries to add a new member to the DistributionGroup1 distribution group, she gets this error:

Changes to the distribution group list membership could not be saved. You do not have sufficient permissions to perform this operation on this object.


Figure 1: User gets a permissions error when trying ot modifying a distribution group membership in Microsoft Outlook

In the past, User1 was able to add/remove members to the distribution group by using Outlook and didn’t need to call the help desk for assistance. What has changed?

You know that you had previously configured SecurityGroup1 to be able to manage this distribution group. Did someone make a change to User1’s security group membership? You look at ADUC first. No change – the user’s still a member of SecurityGroup1.


Figure 2: The user’s still a member of the security group that’s configured to manage the distribution group

Next, you check the distribution group configuration in ADUC to verify that DistributionGroup1 is still being managed by SecurityGroup1.


Figure 3: The user’s still a member of the security group that’s configured to manage the distribution group

Okay, so what’s the deal here? You know you recently migrated to Exchange 2010. So you take a look at DistributionGroup1 in EMC (which reveals that it’s managed by SecurityGroup1, but also displays an ‘Object Not Found’ error).


Figure 4: EMC displays the security group with an ‘Object not found’ error

Why is Exchange 2010 doing this?

This behavior is by design. In Exchange 2010, distribution groups can’t be managed by groups – only individual users can manage groups. So it’s possible that using Exchange 2003, you used groups to manage a distribution group. Group ownership was handled at a different level. Now that these mailboxes have been moved to Exchange 2010, members of these groups can’t modify the group.

So are there any workarounds?

We’ve created a script to work around this limitation. Download Set-DistributionGroupOwners.ps1 from the Script Center.

The script will allow you to simulate a group having ownership of a distribution group in Exchange 2010. The script can be run in three different modes depending on the switches you pass.

  1. Mode 1 – Set Ownership for a particular distribution group. Modifications to the ManagedBy attribute are not set at this time. It will simply modify a Custom Attribute to have the information needed later when the script sets the ManagedBy attribute.
  2. Mode 2 – Modify the ManagedBy attribute of a specific distribution group so the members of either a security group or distribution group can manage it.
  3. Mode 3 – Is designed to be run as a scheduled task and ensure individual members of a group have ownership of the Distribution Group which they are set to own. This mode is used if you prefer to automate the process and perhaps run it nightly to look for any changes to security group and distribution group membership.

Read More from the Source: http://msibrahim.wordpress.com/2011/05/08/how-to-manage-groups-with-groups-in-exchange-2010/

Friday, June 10, 2011

Delete emails in multiple mailboxes in Exchange 2010 SP1

Export-Mailbox is no longer supported in Exchange 2010 sp1, in stead there is New-MailboxExportRequest but the problem is that “-DeleteContents” is not supported with mailbox export.

In order to be able to search and delete emails from multiple Exchange 2010 mailboxes one has to have the following roles assigned.

New-ManagementRoleAssignment -Role "Support Diagnostics" –User username

New- ManagementRoleAssignment -Role "Mailbox Import Export" -User username

above will ensure that a user has proper permissions to perform this command.

In order to find and delete a certain email from one mailbox you can perform the following command

Search-Mailbox -Identity username -SearchQuery 'subject:"Email Subject that you want to search for"' –DeleteContent

this can be run for all mailboxes on a server as well

Get-Mailbox –Server “*servername*” –ResultSize unlimited | Search-Mailbox -SearchQuery 'subject:"Email Subject that you want to search for"' –DeleteContent