Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
Windows Server

Using Windows PowerShell in an Exchange Server 2010 Environment : Using EMS to Do Reporting

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
3/24/2011 9:09:25 PM
EMS has built-in reporting features that use a variety of outputs. For example, the following cmdlet verifies server functionality by logging on to the specified user’s mailbox and reporting the latency (see Figure 1):
Test-MapiConnectivity [email protected]

Figure 1. Output generated by EMS MapiConnectivity Test.

Output is normally sent to the display, but it can also be sent to files using redirection. EMS has special cmdlets that also produce comma-separated values (CSV), Extensible Markup Language (XML), and HTML output. These types of output provide the flexibility that administrators need to manipulate the data using familiar tools, such as Microsoft Excel.

Generating User Distribution Reports

Reports that list user mailbox distribution across all mailbox stores can be helpful to know if the user load is balanced in the organization. The following .ps1 example shows how to produce a report listing the total number of mailbox stores, the number of mailboxes in each store, and the total number of mailboxes.

This .ps1 script contains comments, variables, and error trapping. Comments begin with the “#” symbol and are useful for administrators to understand what the script or cmdlet is doing and are ignored by EMS/PowerShell. Variables always start with the $ symbol and are used to assign values or collections. Error trapping handles exceptions or errors that can occur in the script so that the script continues to run:

#Get all mailbox stores in the organization and assign them to the $MailboxDatabases array variable
$MailboxDatabases = get-mailboxdatabase
write-host "There are" $MailboxDatabases.Count "Mailbox Stores in the organization."
write-host ("-"*70)

#Get each database and assign it to the $Database array variable
ForEach ($Database in $MailboxDatabases) {
#Derive the Mailbox server name from the database
$MailboxServer = $Database.server.name
#Derive the database name from the database
$DatabaseName = $Database.name
#Assign the full database name to the $FullDatabaseName variable
$FullDatabaseName = "$MailboxServer" + "\" + "$DatabaseName"
#Count the number of databases on the server
$count=0
get-mailboxdatabase –server $MailboxServer | ForEach-Object {$count++}
#Get the mailboxes for this database
If ($count –gt 1) {
$mailbox = get-mailbox -database $FullDatabaseName
}
Else {
$mailbox = get-mailbox -database $DatabaseName
}
write-host "There are" $mailbox.Count.toString("#,#") "mailboxes in" $FullDatabaseName

#The trap statement traps the NullException error which occurs when a database has no mailboxes
trap{
write-host "There are no mailboxes in" $FullDatabaseName;
continue
}
}

write-host ("-"*70)
#Get all mailboxes in the organization
$mailboxes = get-Mailbox
write-host "The total number of mailboxes in the organization is" $mailboxes.count.tostring("#,#")


Working with Event Logs

Exchange Server administrators often work with Windows event logs to troubleshoot issues. Because EMS runs in the PowerShell environment, the administrator can take advantage of PowerShell’s Get-Eventlog cmdlet to work with event logs.

This example displays all events in the Application Event Log in which the source begins with the word “Exchange.” The output is exported to a CSV file for easy manipulation in Microsoft Excel:

get-eventlog Application | where {$_.Source -ilike "Exchange*"} | export-csv c:\events.csv			  

Other -----------------
- Exchange Server 2010 : Using EMS to Do Administrative Mailbox Tasks (part 2)
- Exchange Server 2010 : Using EMS to Do Administrative Mailbox Tasks (part 1)
- SharePoint 2010 PerformancePoint Services : Excel Services Data Source
- SharePoint 2010 PerformancePoint Services : PowerPivot Data Sources
- Windows Server 2003 : Monitoring Network Protocol Security (part 7)
- Windows Server 2003 : Monitoring Network Protocol Security (part 6) - Use Netsh to Manage IPSec
- Windows Server 2003 : Monitoring Network Protocol Security (part 5) - Create a Negotiation Policy
- Windows Server 2003 : Monitoring Network Protocol Security (part 4) - Use the IP Security Management Snap-In to Create a Blocking Policy
- Windows Server 2003 : Monitoring Network Protocol Security (part 3) - Understanding Kerberos
- Windows Server 2003 : Monitoring Network Protocol Security (part 2) - Negotiation Process
 
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
 
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server