Wednesday, October 19, 2011

Exchange 2010 - PowerShell Commands - III

Remove a message from Mail Queue

Remove-message -filter {FromAddress -eq “”} -WithNDR $false

Get-Message -queue "ny-cas-2k8\319045" | remove-message -Confirm:$false

Send an Email from PowerShell v1.0

PS C:\> $smtp = New-Object Net.Mail.SmtpClient("")
PS C:\> $smtp.Send("","","Test Email","This is a test")

Send an Email from PowerShell v2.0

PS C:\> $PSEmailServer = ""
PS C:\> Send-MailMessage -From "" -To "" -Subject "Test email" -Body "This is a test email"


Get-MailboxDatabase 'Mailbox-Dbase-1' | Get-MailboxStatistics | Sort totalitemsize -desc | Export-CSV C:\Mailbox-Stat.csv

No comments:

Quote of the Day