Archive

Posts Tagged ‘Exchange 2010’

Get list of mail sent and received on Exchange 2010


To get an list of emails running in and out from your exchange server you can use this powershell to retrieve all emails.

Get-TransportServer | Get-MessageTrackingLog -Start “12/03/2012 12:00am” -ResultSize Unlimited -EventId “receive” | Where {$_.Recipients -like “address@domain.com”}

-EventId has the following syntaxes:
BADMAIL
DEFER
DELIVER
DSN
EXPAND
FAIL
POISONMESSAGE
RECEIVE
REDIRECT
RESOLVE
SEND
SUBMIT
TRANSFER

And you can change -like “address@domain.com” to for example -match “@domain.com” to get ALL emails.

How to clear move-requests in Exchange 2007/2010

September 11, 2012 Leave a comment

Run this command in powershell to clear completed move-requests

Get-MoveRequest -MoveStatus Completed | Remove-MoveRequest

Exporting distribution list membership to Excel


Easy one-liner for exporting members of a distribution list:

Get-DistributionGroupMember -identity "company-dl" Export-Csv C:\MyFile.Csv

you can also use “-not” that gives you a nice csv file

Get-DistributionGroupMember -identity "company-dl" Export-Csv C:\MyFile.Csv -not

Exchange 2007/2010 – Hide users from global adress list (GAL)


Hide all users:

1, Connect PowerShell to Exchange.
2, Run the following command:
Get-Mailbox Alias | Set-Mailbox -HiddenFromAddressListsEnabled $True
Change Alias to your user’s information.

Hide users in a spesific OU

1, Connect PowerShell to Exchange.
2, Run the following command:
get-mailcontact -OrganizationalUnit “contoso.com/path/to/ou” | Set-mailContact -HiddenFromAddressListsEnabled $true -whatif

List users and size of mailbox in Exchange 2007 and 2010 with Powershell


Get-Mailbox | Get-MailboxStatistics | select-object DisplayName, {$_.TotalItemSize.Value.ToMB()}

Find emails with Powershell commandlets

December 19, 2011 Leave a comment

Get-MessageTrackingLog -start “12/18/2011 08:00” -Sender user@domain.com | Format-List sender, Recipients, timestamp, MessageSubject

Get-MessageTrackingLog -MessageSubject Testsubject

Import PST file to exchange mailbox from Powershell

November 24, 2011 Leave a comment

New-MailboxImportRequest –Mailbox bruker –FilePath \servermappenavn.pst

%d bloggers like this: