Some
useful EMS Cmdlets to get the valuable information from Exchange Server 2010,
as per your Organization requirements:
Number of E-mails
Sent and Received by one User
This is very powerful
script used to check the Send & Receive Emails by a user:
[Int]
$intSent = $intRec = 0
Get-TransportServer
| Get-MessageTrackingLog -ResultSize Unlimited -Start “10/01/2012” -End “11/01/2012”
-Sender " arun@excEvehangeby-arun.com" - EventID
RECEIVE | ? {$_.Source -eq "STOREDRIVER"} | ForEach {
$intSent++ }
Get-TransportServer
| Get-MessageTrackingLog -ResultSize Unlimited -Start “10/01/2012” -End
“11/01/2012” -Recipients " arun@exchangeby-arun.com" -EventID DELIVER
| ForEach { $intRec++ }
This script is
used to get the size of recoverable items of per Mailbox-Database:
Get-MailboxFolderStatistics
nuno –FolderScope RecoverableItems | Select Identity,
FolderAndSubfolderSize
[Int]
$total = 0
(Get-Mailbox
-Database MDB16 -ResultSize Unlimited) | ForEach {$total +=
(Get-MailboxFolderStatistics $_ -FolderScope RecoverableItems | ? {$_.Identity
-match "Recoverable Items"}).FolderAndSubfolderSize.ToMB()}
$total
This script is
used to update or modified the IP Address on Exchange Receive Connector:
# Get
Receive Connectors to update
$recCons= Get-ReceiveConnector
| Where {$_.Name -match"Unauthenticated SMTP"}
ForEach ($recConin$recCons)
{
Write-Host"Updating", $recCon.Identity
$recCon.RemoteIPRanges -="10.101.74.10"
$recCon.RemoteIPRanges -="10.102.34.12"
Set-ReceiveConnector $recCon -RemoteIPRanges$recCon.RemoteIPRanges
}
This script is used to create a
Transport Rule in Exchange Serve 2010:
New-TransportRule “Block
Non Delivered e-mails from Nuno” -Comments ”Prevent Nuno from forwarding
NDRs e-mails” -From “nuno@letsexchange.com” -SentToScope “NotInOrganization” -SubjectContainsWords “FW:
There was an error sending your mail”, “FW: Mail delivery failed”, “FW:
failure notice” -RedirectMessageTo “quarantine@letsexchange.com”-Enabled $True
This script is
used to check the full access permissions to any other User-Mailbox:
Get-Mailbox
-Resultsize Unlimited | Get-MailboxPermission -User | ? {$_.AccessRights -match "FullAccess" -and$_.IsInherited -eq $False}
| Select Identity
ForEach ($mbx in (Get-Mailbox
-Resultsize Unlimited | Select Identity)) {Get-MailboxPermission $mbx.Identity
-User | ? {$_.AccessRights -match "FullAccess" -and $_.IsInherited -eq $False}
| Select Identity}
This script is
used to make the comparisons between the Primary & Secondary IP Address:
[String] $strPrimaryAddress
[String] $strSIP
[Array] $arrCollection = @()
ForEach ($mbx in (Get-Mailbox -ResultSize
Unlimited))
{
# Initialize object
to hold all the information
$mbcomb = "" | Select "Display
Name", "Primary SMTP Address", "SIP"
# Reset variables
$strPrimaryAddress = $strSIP = $NULL
# Check all the
e-mail aliases the user has
$mbx.EmailAddresses
| ForEach {
If ($_.IsPrimaryAddress -and $_.Prefix -match "SMTP")
{ $strPrimaryAddress = $_.SmtpAddress }
If ($_.PrefixString -eq "sip")
{ $strSIP = $_.AddressString }
}
# Compare the
primary SMTP with the SIP address
If ($strPrimaryAddress -ne $strSIP)
{
$mbcomb."Display
Name" = $mbx.DisplayName
$mbcomb."Primary
SMTP Address" = $strPrimaryAddress
$mbcomb."SIP" = $strSIP
$arrCollection += $mbcomb
}
}
# Print or export all the results
$arrCollection | FT
#$arrCollection | Export-Csv
D:\Scripts\"SMTPvsSIP_$(Get-Date -f 'yyyyMMdd').csv" -NoType
get-mailbox | where {$_.UseDatabaseQuotaDefaults -ne $true}
Get-Mailbox Database
Statics
This command is
used for get the Mailbox Database statics:
[PS]
C:\>Get-MailboxDatabase
Name Server Recovery ReplicationType
---- ------ -------- ---------------
Mailbox
Database 0020849825 Exchangeby-Arun-Ex001 False Remote
Mailbox
Database 2 Exchangeby-Arun-Ex-02 False Remote
If you like these scripts, please leave your comments here.
Thanks
Arun chaudhary
Email me: arunkalagarh@gmail.com
No comments:
Post a Comment