Citrix Unknow Commands
Mailbox Details (askme4tech.com)
Before months i had a request to export size of mailboxes from our Exchange Server. As we know this can't happened from Exchange Management Console except if you start to type in Excel one by one the Users. When you will finish? You don't know. So i use Exchange Management Shell to export all mail enable Users, email addresses from all Databases or from specific databases of Exchange Server and save it in CSV file. It will take maximum 5 minutes.
As you already know Powershell it's very powerfull and can use it in your day by day tasks to automate your work.
This article can help you with few commands to get Reports in minute from Exchange Server.
But as IT Pro you manage different Systems like Domain Controllers , HYPER-V Hosts , Workstations and more.
In the Category of Powershell you can find more commands and simple tools that can help you to export different types of Reports from Active Directory ,Servers and Workstations.
So let's start !
Login in your Exchange Server
Go Start - - >Exchange Server 2010 - - > Exchange Mnagament Shell.
View Mail Enable Users Email Addresses.
Get-Mailbox -ResultSize Unlimited -RecipientType UserMailbox | Select Displayname,EmailAddresses
askme4tech.com 2 mins read
Export Mail Enable Users Email Addresses in CSV.
Get-Mailbox -ResultSize Unlimited -RecipientType UserMailbox | Select Displayname,EmailAddresses | Export-csv c:\csv\mailenableusers.csv
View Mail Enable Users Email Addresses from Specific Database.
Get-Mailbox -ResultSize Unlimited -RecipientType UserMailbox Database "Mailbox Database 0118323219" | Select Displayname,EmailAddresses,Database
Export Mail Enable Users Email Addresses from Specific Database in CSV.
Get-Mailbox -ResultSize Unlimited -RecipientType UserMailbox Database "Mailbox Database 0118323219" | Select Displayname,EmailAddresses,Database | Export-csv c:\csv\mailenableusersdatabase.csv
View Mail Enable User Mailboxes included the Size of Mailboxes.
Get-MailboxStatistics -Server dc | Select Displayname,TotalItemSize,ItemCount
Export Mail Enable User Mailboxes included the Size of Mailboxes in CSV.
Get-MailboxStatistics -Server dc | Select Displayname,TotalItemSize,ItemCount | Export-csv c:\csv\mailboxessize.csv
Until now we use Get-Mailbox command to view or export all mail enable Users. in Exchange Server except from Mail Enable Users we have email addresses from Distribution Groups and Contacts. With Get-Mailbox we ca get only Mail enable user email addresses. So i found another one command Get-Recipient that we can use to export all email addresses from Exchange Server
View all email addresses included Disitribution Groups and Contacts.
Get-Recipient| select name -ExpandProperty emailaddresses | select name,smtpaddress
Export all email addresses included Disitribution Groups and Contacts in CSV.
Get-Recipient| select name -ExpandProperty emailaddresses | select name,smtpaddress | Export-csv c:\csv\mailboxessize.csv
Export all email addresses from specific Disitribution Group in CSV.
Get-DistributionGroup -Identity <"DistributionGroup Name" | GetDistributionGroupMember | select name,primarysmtpaddress >C:\Powershell-Exports\dg.txt
If you are intresting to export Reports from Active Directory download our Powershell Tool to do it.
Find some intresting articles that maybe want to read.
Use Powershell to export Reports from Active Directory Use WMI with Powershell to Discover Monitor Information Monitoring Domain Controller Health Status with PowerShell
That's it for now.
I will come back next week with new commands.
Do your comments or ask anything that you want here or send me an email in info@askme4tech.com . I will be here to answer your questions.
Some Data from Techrid.com (Mailbox Related Data)
@ Techrid.com
Count of User Mailbox in Organization
Number Mailbox in each Database
Mailbox Size & Statistics
Command : (Get-Mailbox).Count
If your Organization have 1000+ employees use the command same with Result size as Unlimited.
Command : (Get-Mailbox -resultsize unlimited).Count
want gathering Individual User Mailbox with Total Item Count, Storage Limit status and users Last logon. Then below is the command
Command :
[PS] C:\>Get-MailboxStatistics -Identity “User Mailbox Name”
Now List of User Mailboxes hosted in the Database with Display name and TotalItemSize with Storagelimitstatus
Command :
[PS] C:\>Get-MailboxDatabase “Database Name” | Get-MailboxStatistics | sort totalitemsize -desc | ft displayname, totalitemsize, itemcount, storagelimitstatus
In this if you want to deep dive and want to Identify first 5 or 10 mailbox with huge size of Mailbox below is the command to run
Command :
[PS] C:\>Get-Mailbox | Get-MailboxStatistics | Sort-Object TotalItemSize -desc | Select-Object -First 5 | ft displayname,@{Expression={$_.TotalItemSize.Value.ToGb()};label=”T
otal Mailbox Size in Gb”}
If you want to check by name the exclude the Get-Mailbox and directly go with Get-Mailboxstatistics and when Prompts for Identity provide user Mailbox name as shown below:
Command :
[PS] C:\>Get-MailboxStatistics | Sort-Object TotalItemSize -desc | Select-Object First 5 | ft displayname,@{Expression={$_.TotalItemSize.Value.ToGb()};label=”Total Mailbox Si
ze in Gb”}
First 5 User with huge mailbox size within the specific Database then below is the command:
Command :
[PS] C:\>Get-MailboxStatistics -Database “Database Name” | Sort-Object TotalItemSize -desc | Select-Object -First 5 | ft displayname,@{Expression={$_.TotalItemSize.Value.ToGb()};
label=”Total Mailbox Size in Gb”}
Now Check the number of Mailbox in each Database
Segregating the number of user hosted on each Database.
Command :
[PS] C:\>Get-Mailbox | Group-Object -Property:Database | Select-Object name,count
Now gathering the details with Server Name, StorageGroupName, Database Name, Size (GB), Size (MB), No. Of Mailbox, below is the command:
Command :
[PS] C:\>Get-MailboxDatabase | Select Server, StorageGroupName, Name, @{Name=”Size (GB)”;Expression={$objitem = (Get-MailboxDatabase $_.Identity); $path = “`\`\” + $objitem.se
rver + “`\” + $objItem.EdbFilePath.DriveName.Remove(1).ToString() + “$”+ $objItem.EdbFilePath.PathName.Remove(0,2); $size = ((Get-ChildItem $path).length)/1048576KB; [math]::r
ound($size, 2)}}, @{Name=”Size (MB)”;Expression={$objitem = (GetMailboxDatabase $_.Identity); $path = “`\`\” + $objitem.server + “`\” + $objItem.EdbFilePath.DriveName.Remove(
1).ToString() + “$”+ $objItem.EdbFilePath.PathName.Remove(0,2); $size = ((GetChildItem $path).length)/1024KB; [math]::round($size, 2)}}, @{Name=”No. Of Mbx”;expression={(Get
Mailbox -Database $_.Identity | Measure-Object).Count}}
If you want to export below is the command :
Command :
[PS] C:\>Get-MailboxDatabase | Select Server, StorageGroupName, Name, @{Name=”Size (GB)”;Expression={$objitem = (Get-MailboxDatabase $_.Identity); $path = “`\`\” + $objitem.se
rver + “`\” + $objItem.EdbFilePath.DriveName.Remove(1).ToString() + “$”+ $objItem.EdbFilePath.PathName.Remove(0,2); $size = ((Get-ChildItem $path).length)/1048576KB; [math]::r
ound($size, 2)}}, @{Name=”Size (MB)”;Expression={$objitem = (GetMailboxDatabase $_.Identity); $path = “`\`\” + $objitem.server + “`\” + $objItem.EdbFilePath.DriveName.Remove(
1).ToString() + “$”+ $objItem.EdbFilePath.PathName.Remove(0,2); $size = ((GetChildItem $path).length)/1024KB; [math]::round($size, 2)}}, @{Name=”No. Of Mbx”;expression={(Get
Mailbox -Database $_.Identity | Measure-Object).Count}} | Export-CSV C:\ServerStat-2.csv
[PS] C:\>
Now want to check the list of users hosted in the Database then below is the command
Command :
[PS] C:\>Get-MailboxDatabase “DatabaseName” | Get-MailboxStatistics | Sort totalitemsize -desc | ft displayname, totalitemsize, itemcount
If you have more than 50+ users and if you want to export below is the command
← Exchange 2010 to 2013 mailbox migration is Very slow
Exchange 2013 CU8 to CU12 Upgrade – Unattended Mode →
Command :
[PS] C:\>Get-MailboxDatabase “FBMBXDB01” | Get-MailboxStatistics | Sort totalitemsize -desc | ft displayname, totalitemsize, itemcount >C:\MB.csv
Ok we are done with Mailboxes.
Last but not least Database Size and free space
Gathering Database Size with New Available New Mailbox Space
Command :
[PS] C:\>Get-MailboxDatabase -Status | select Name,DatabaseSize,AvailableNewMailboxSpace
Checking Database Size
Command :
[PS] C:\>Get-MailboxDatabase -Status | select ServerName,Name,DatabaseSize
Display Full Name of Stopped Exchange Services
Command-
Get-Service | Where-Object {$_.Name -Like ‘MSExchange*’ -and $_.Status -eq ‘Stopped’}
Test-ReplicationHealth | where {$_.Check -like "QuorumGroup"} | fl