Archive for Powershell

Examples Exchange Server 2010 Management Shell command lines Part 1

Posted in Exchange 2010 with tags , , , , on October 14, 2012 by uniekdevries

Here are some examples of Exchange Management Shell commandlines I frequently use.

Import a PST file in the mailbox of UserA

New-MailboxImportRequest -Mailbox UserA -FilePath \\server\d$\pst\UserA.pst -BadItemLimit 10

View statistics of all running import requests

Get-MailboxImportRequest -Status InProgress| get-MailboxImportRequeststatistics

Import all pst files found in de PST directory. Make sure the name of the PST file correspondends with the target username

Dir \\server\d$\PST\*.pst | %{ New-MailboxImportRequest -Name import -BatchName batch1 -Mailbox $_.BaseName -FilePath $_.FullName -BadItemLimit 10}

Import a PST file in a subfolder of the mailbox

New-MailboxImportRequest -Mailbox UserA -name Archive -FilePath “\\server\d$\archive 2011.pst” -BadItemLimit 10 -Targetrootfolder Archive2011 

Give UserB full mailbox permissions to the mailbox of UserA 

Add-MailboxPermission -Identity “UserA” -User UserB -AccessRight FullAccess

Give UserB “Send as”  permissions for MailboxA 

Add-ADPermission -Identity ‘CN=MailboxA,OU=Mailboxen,DC=domain,DC=local’ -User ‘UserB’ -ExtendedRights ‘Send-as’

Set review permissions on a user’s mailbox for a mail enabled group 

Add-MailboxFolderPermission -Identity UserA:\Calendar -user GroupB@domain.local -Accessright reviewer

How to view total size of a mailbox? 

Get-MailboxStatistics -identity UserA| ft DisplayName, TotalItemSize, ItemCount

Create a new addresslist  based on emailaddress (domain name)

new-addresslist -name AddresslistA -recipientfilter {(emailaddresses -like “*“)}