Tuesday, June 4, 2013

How to Enable Export-Mailbox or Import-Mailbox Powershell commands

When using powershell in  Exchange 2010 or Exchange 2013 and you try Export-Mailbox or Import-Mailbox the commands or delete messages from multiple mailbox, you will get error since these are not available by default, we need to enable them…
 
Note, if you are running exchange 2010 SP1 and above and you are trying to delete multiple emails then go here http://www.techieshelp.com/delete-mail-from-multiple-mailboxes/
IT Solution
1) Check if you have the Exchange Server Admin Tasks installed in the Exchange Management Shell
 

Get-PSSnapin
 
2) It should not be in the list displayed as you cannot run the command. Run the command below to see what is registered.
 

Get-PSSnapin -registered
 
3) Now to install the appropriate "Admin Tasks for the exchange Server" run the command below:
 

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
 
NOTE: for MS Exchange 2007 you should change the point (3) to a command like the one below:
 

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin
 
You will now find the import and export commands are available in powershell
If you want to add multiple users or groups to be able to run these commands use the command below, it will create two new security groups with the members you specify.
New-RoleGroup -Name "Exchange Mailbox Import Export" -Roles "Mailbox Import Export" -Members "<yourdomainyourgroupname>" -DisplayName ""Exchange Mailbox Import Export" -Description "This group handles permissions to the import and export commands in powershell."
That creates a group and adds users who are allowed access to the import and export powershell commands.
New-RoleGroup -Name "Exchange Support and Diagnostics" -Roles "Support Diagnostics" -Members "" -DisplayName ""Exchange Support Diagnostics" -Description "This group handles permissions to the support diagnostics cmdlets in exchange."."
That creates a group and adds users who are allowed access to all the exchange powershell diagnostics applets
 

No comments:

Post a Comment