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 have 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.
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. Get-Mailbox
"yourDomain\yourVictim"
# PowerShell command to set the quota Get-Mailbox "yourDom\yourUser" |
set-Mailbox -ProhibitSendQuota 100MB
Guy Recommends: Solarwinds' Free Bulk Import Tool
Import users from a spreadsheet. Just provide a list of the
users with their fields in the
top row, and save as .csv file. Then launch this FREE utility and match
your fields with AD's
attributes, click to import the users. Optionally, you can
provide the name of the OU where the new accounts will be born.
There are also two bonus tools in this free download, and all 3 have been approved by Microsoft:
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: Test-SystemHealth
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.
Guy Recommends:
The SolarWinds Exchange Monitor
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 product for free, as part of their commitment to
supporting the network management community.
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.
Windows Management Instrumentation (WMI) is one of the hidden
treasures of Microsoft operating systems.
Fortunately, Solarwinds
have created the
Free WMI Monitor so that you can actually see and understand these gems of
performance information. Take the guess work out of which
WMI counters to use for applications like Microsoft Active Directory,
SQL or Exchange Server.