Microsoft Windows Server 2008 R2 and Exchange 2010

Windows Server 2008 R2 builds on the award-winning foundation of Windows Server 2008, expanding existing technology and adding new features to enable IT professionals to increase the reliability and flexibility of their server infrastructures. New virtualization tools, Web resources, management enhancements, and exciting Windows 7 integration help save time, reduce costs, and provide a platform for a dynamic and efficiently managed data center. Powerful tools such as Internet Information Services (IIS) version 7.5, updated Server Manager and Hyper-V platforms and Windows PowerShell version 2.0 combine to give customers greater control, increased efficiency and the ability to react to front-line business needs faster than ever before......

Tuesday, January 10, 2012

Useful Power Shell Command in Exchange 2010


Find Which Exchange 2010 CAS Server a Client Connects To
Get-LogonStatistics -Server BLEXCHMBX01 |ft username, clientname, clientversion
(clientname gives you the CAS)

or for a user:
Get-LogonStatistics -Identity yfaruqe | Sort-Object "LastAccessTime" |  ft  username, clientname, *last*

Use the Shell to update a mailbox database copy
This example shows how to seed a copy of a database named DB1 on MBX1.
Update-MailboxDatabaseCopy -Identity DB1\MBX1
This example shows how to seed a copy of a database named DB1 on MBX1 using MBX2 as the source Mailbox server for the seed.
Update-MailboxDatabaseCopy -Identity DB1\MBX1 -SourceServer MBX2
This example shows how to seed a copy of a database named DB1 on MBX1 without seeding the content index catalog.
Update-MailboxDatabaseCopy -Identity DB1\MBX1 -DatabaseOnly
This example shows how to seed the content index catalog for the copy of a database named DB1 on MBX1 without seeding the database file.
Update-MailboxDatabaseCopy -Identity DB1\MBX1 -CatalogOnly

How to Rebuild the Full-Text Index Catalog

Database Copy Automatic Activation Policy is also an option for blocking the automatic activation
Get-MailboxServer BLEXCHMBX03 | Fl Name, DatabaseCopyAutoActivationPolicy
OR
Get-MailboxDatabaseCopyStatus -Server BLEXCHMBX03 | FL DatabaseName, ActivationSuspended

Quickly View the Current Mailbox Size, Message Count, and Last Logon
Syntax
Get-MailboxStatistics -Identity 'Identity' [-Archive <$true|$false>] [-DomainContoller DomainController]
[-IncludeMoveHistory <$ true|$false>] [-IncludeMoveReport <$true|$false>]
Get-MailboxStatistics -Server 'Server' | -Database 'Database' [-DomainContoller DomainController]
Usage
Get-MailboxStatistics -Server 'corpsvr127'
Get-MailboxStatistics -Database 'Engineering Primary'


How to Find Exchange Server 2010 Mailboxes without Storage Quotas
[PS] C:\>get-mailbox | where {$_.UseDatabaseQuotaDefaults -eq $False}

Name        Alias                ServerName       ProhibitSendQuota
----       -----                ----------       -----------------
DiscoverySearchMailbox... DiscoverySearchMa... ex2              50 GB (53,687,091,200 bytes)
Carole.Malik              Carole.Malik         ex2              unlimited
Davina.Nsiah              Davina.Nsiah         ex2              5.371 GB (5,767,168,000 bytes)
Helen.Cail                Helen.Cail           ex2              4.688 GB (5,033,164,800 bytes)
Jas.Mahal                 Jas.Mahal            ex2              unlimited
Lorraine.Oza              Lorraine.Oza         ex2              unlimited
Oliver.Loffler            Oliver.Loffler       ex2              4.688 GB (5,033,164,800 bytes)

The output above shows that some mailboxes have no quotas, whereas others have custom storage quotas applied. To see the full details of the storage quotas configured on these mailboxes use the following command in the Exchange Management Shell.
[PS] C:\>get-mailbox | where {$_.UseDatabaseQuotaDefaults -eq $False} | ft name,prohibit*,issue*


However if you want to see a list of users mailbox sizes then you will need to use PowerShell.
Get-MailboxServer | Get-MailboxStatistics | select displayname,itemcount,totalitemsize | Conver
tTo-HTML | Out-File D:\Test.htm

See Mailbox Statics of a particular Database
Get-MailboxStatistics -Database 'MDB06'| select displayname,itemcount,totalitemsize

Get-MailboxStatistics -Server BLEXCHMBX02 |Sort-Object -Property TotalItemSize -Descending |Select-Object -property DisplayName,@{N="ItemCount";E={$_.ItemCount}},@{N="TotalItemSize";E={$_.TotalItemSize.value.ToMB()}},@{N="deletedItemCount";E={$_.deletedItemCount}},@{N="TotalDeletedItemSize";E={$_.TotalDeletedItemSize}},@{N="Database";E={$_.Database}} |Export-CSV -Path c:\Notice\MailboxReport.csv -NoTypeInformation

To View the statistics in MB
Get-MailboxStatistics -Database MDB06 |Sort-Object -Property TotalItemSize -Descending |Select-Object -property DisplayName,@{N="ItemCount";E={$_.ItemCount}},@{N="TotalItemSize";E={$_.TotalItemSize.value.ToMB()}},@{N="deletedItemCount";E={$_.deletedItemCount}},@{N="TotalDeletedItemSize";E={$_.TotalDeletedItemSize.value.ToMB()}},@{N="Database";E={$_.Database}} |Export-CSV -Path D:\MDB06.csv -NoTypeInformation
Check Exchange Database Size:


Get-MailboxDatabase -Status | select ServerName,Name,DatabaseSize

ServerName                              Name                                    DatabaseSize
----------                              ----                                    ------------
XXEXCHMBX01                             MDB01                                   107.4 GB (115,301,482,496 bytes)
XXEXCHMBX01                             MDB02                                   119.9 GB (128,723,779,584 bytes)
XXEXCHMBX01                             MDB03                                   115 GB (123,488,763,904 bytes)
XXEXCHMBX02                             MDB04                                   112.5 GB (120,804,409,344 bytes)
XXEXCHMBX02                             MDB05                                   103.1 GB (110,738,079,744 bytes)
XXEXCHMBX02                             MDB06                                   179.4 GB (192,610,893,824 bytes)


Exchange 2010 Find Database White Space
Get-MailboxDatabase -Status | Select-Object Server,Name,AvailableNewMailboxSpace

Server                                  Name                                    AvailableNewMailboxSpace
------                                  ----                                    ------------------------
XXEXCHMBX01                             MDB01                                   17.59 MB (18,448,384 bytes)
XXEXCHMBX01                             MDB02                                   121 MB (126,844,928 bytes)
XXEXCHMBX01                             MDB03                                   110 MB (115,343,360 bytes)
XXEXCHMBX02                             MDB04                                   44.81 MB (46,989,312 bytes)
XXEXCHMBX02                             MDB05                                   29.09 MB (30,507,008 bytes)
XXEXCHMBX02                             MDB06                                   15.86 GB (17,031,495,680 bytes)

Get-MailboxDatabase MDB06 -Status | FL AvailableNewMailboxSpace

Set Quota of Retention Item
Set-MailboxDatabase -Identity MDB03 -RecoverableItemsWarningQuota 20GB -RecoverableItemsQuota 30GB

Get Recoverable Items Folder Statistics
The Recoverable Items folder contains items deleted by Microsoft Outlook and Microsoft Office Outlook Web App users or by the Mailbox Assistant
Get-MailboxFolderStatistics -Identity "Sanjoy Saha" -FolderScope RecoverableItems | Format-List

Get-MailboxFolderStatistics -Identity "Nizar El-Assaad" -FolderScope RecoverableItems | Format-Table Name,FolderPath,ItemsInFolder,FolderAndSubfolderSize

Get-MailboxFolderStatistics -Identity "Maruf Ahmed" -FolderScope RecoverableItems | Format-Tabl
e Name,FolderPath,ItemsInFolder,FolderAndSubfolderSize

Name                          FolderPath                                    ItemsInFolder FolderAndSubfolderSize
----                          ----------                                    ------------- ----------------------
Recoverable Items             /Recoverable Items                                     2043 1.332 GB (1,430,546,505 by...
Deletions                     /Deletions                                             6619 1.315 GB (1,412,322,237 by...
Purges                        /Purges                                                   0 0 B (0 bytes)
Versions                      /Versions                                                 0 0 B (0 bytes)


To display the user's alias formatted in a table together with the user's Exchange 2010 server name and telephone extension, type:

 Get-Mailbox | Format-Table ServerName,@{e={$_.SamAccountName};Label="User Alias"},@{Expression="Extensions";Label="Telephone numbers

1 comment: