Exchange PowerShell commands


Few frequently used exchange management shell commands

Here are few frequently used exchange management shell command used by the system/exchange admin staffs in regular basis for the easy reference:

Regular Mailbox
Set-Mailbox -Identity (Mailbox Name) -Type Regular

Room Mailbox
Set-Mailbox -Identity (Mailbox Name) -Type Room

Equipment Mailbox
Set-Mailbox -Identity (Mailbox Name) -Type Equipment

Shared Mailbox
Set-Mailbox -Identity (Mailbox Name) -Type Shared

List all mailboxes in the database
(useful to determine mailbox size)

Get-Mailbox -Database EXCH-DB | Get-MailboxStatistics | select DisplayName,TotalItemSize | sort TotalItemSize

Save output to the text file.

Get-Mailbox -Database EXCH-DB | Get-MailboxStatistics | select DisplayName,TotalItemSize | sort TotalItemSize >c:\temp\icgsg.csv

Note: EXCH-DB is name of your exchange database.

Local mailbox move to another exchange database

New-MoveRequest –Identity user@mydomain.com –TargetDatabase ‘EXCH-Target-DB’

#Determine size of your exchange database

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

#Following PS command will export mailbox usersname, emmail items count, size and last logon time from particular exchange database. eg. -Database “Name of  your datase here”

Get-MailboxStatistics -Database “Exchange databasename” | Select DisplayName, LastLoggedOnUserAccount, ItemCount, TotalItemSize, LastLogonTime, LastLogoffTime | Export-CSV abc.csv

#Display size in MB or GB; just change $_.totalitemsize.value.ToGB()

Get-MailboxStatistics -Database “Exchange databasename” | Format-Table DisplayName, LastLoggedOnUserAccount, ItemCount, @{expression={$_.totalitemsize.value.ToMB()};label=”Size(MB)”}, LastLogonTime, LastLogoffTime

we can add below list of columns …

AssociatedItemCount
Database
DatabaseName
DeletedItemCount
DisconnectDate
DisplayName
Identity
ItemCount
LastLoggedOnUserAccount
LastLogoffTime
LastLogonTime
LegacyDN
MailboxGuid
ServerName
StorageGroupName
StorageLimitStatus
TotalDeletedItemSize
TotalItemSize

Advertisements

About Robiul

Robiul has 15 years of continuous successful career experience in ICT with extensive background in System Engineering, IT infrastructure design, operations and service delivery, managing IT projects / MIS functions for local and multi-national companies with in-depth knowledge of multiple operating systems as well as construct / manage small to medium size Data Center. Proven ability to design and implement medium to semi-large scale LAN/WAN/WLAN and system infrastructures. Academic qualification: Master of Science in Information Systems. Professional certifications are: MCSE, CCNA, ITIL and FoundStone Security Professional, VCP, NetAPP, CISSP etc.
This entry was posted in Exchange and tagged . Bookmark the permalink.