Microsoft's PowerShell in Exchange Server 2007
Introduction to PowerShell in Exchange Server 2007
The long-term reason for learning PowerShell is to configure Exchange 2007 and Windows Server 2008. However, you can get started with PowerShell right now. I suggest that you begin by using PowerShell instead of cmd. My point is that all the commands such as ping, ipconfig and netstat perform in PowerShell just as they do in the cmd.exe shell. The benefit is that you will get used to the new PS> interface and may even risk a few PowerShell commands.
To prepare for administering the successor to Exchange 2003, I recommend that you download PowerShell and start experimenting with Verb-Noun instructions at the PS > prompt. Feel free to copy or modify my examples, better still, create your own scripts.
Let me be clear, Exchange 2007 has a GUI for its System Manager, however, for a repetitive task or a clever configuration, Microsoft is saying that you need to learn PowerShell.
Microsoft has redesigned Exchange Server 2007 from scratch. What their research found is that in Exchange 2003, because of the deep nesting, it's difficult to find settings in the System Manager. Therefore, Microsoft reason, it will be quicker to configure settings with a few crisp instructions from the PowerShell command line, than endlessly searching through menus in the GUI.
Microsoft's argument goes on to propose that scripting can achieve complex configurations that are not possible from the GUI menu. For example, I saw a PowerShell script that not only created users and their mailboxes, but also load-balanced the mailboxes between storage groups. Typical Microsoft, you will be able to get the best of both worlds, begin with the GUI, but press an option to create PowerShell scripts, which you can then modify with a text editor.
PowerShell Example 1: Get Mailbox Exchange Server 2007
Here is a real life task to set a users mailbox quota. Naturally, you to have Exchange Server 2007 installed before running this PowerShell command:
# PowerShell command to retrieve a user's mailbox.
# PowerShell command to set the quota
SolarWinds' Network Performance Monitor will help you discover what's happening on your network. This utility will also guide you through troubleshooting; the dashboard will indicate whether the root cause is a broken link, faulty equipment or resource overload.
What I like best is the way NPM suggests solutions to network problems. Its also has the ability to monitor the health of individual VMware virtual machines. If you are interested in troubleshooting, and creating network maps, then I recommend that you try NPM now.
By all means experiment with Get, and if you know what you are doing, Mount, Dismount, Clean or even Remove.
PowerShell Example 2: List Roles in Exchange Server 2007
# PowerShell command to list Exchange 2007 Server roles
Before you run the Test-SystemHealth command make sure that your logon account has been delegated the Exchange Server Administrator role and is a member of the local Administrators group for the target server.
# Simple PowerShell Example:
Example Results: ServicesRunning
Mailbox Role e.g. MSExchangeSA
Client Access e.g. MSExchangeADTopology
The above are merely examples, the full results list all the Exchange Services and show which are running and which are not.
Here is a free tool to monitor your Exchange Server. Download and install the utility, then inspect your mail queues, monitor the Exchange server's memory, confirm there is enough disk space and check the CPU utilization.
This is the real deal - there is no catch. SolarWinds provides this fully-functioning freebie, as part of their commitment to supporting the network management community.
Parameters for Test-SystemHealth
Get-Help Test-SystemHealth -full
Note: Although the -Role parameter is 'Reserved', you may like to try these commands depending on your Exchange Server 2010.
-Role ClusterMailbox # (Active Mailbox role)
-Role Gateway # (Edge role)
-Role Bridgehead # (Hub Transport role)
PowerShell is a potent scripting language for Exchange Server 2007 servers. Moreover, one day PowerShell will be Microsoft's standard scripting shell. One killer reason for learning PowerShell is that you can perform tasks that are not possible through the Exchange System Manager GUI.
If you like this page then please share it with your friends
See More Windows PowerShell Examples of Real-life Tasks
Please email me if you have a better example script. Also please report any factual mistakes, grammatical errors or broken links, I will be happy to correct the fault.