Home > Microsoft Exchange Tips > Exchange Server Administration Tips > Automate complex Exchange 2007 Management Shell tasks via scripting
Exchange Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

EXCHANGE SERVER ADMINISTRATION TIPS

Automate complex Exchange 2007 Management Shell tasks via scripting


Brien Posey
11.05.2008
Rating: --- (out of 5)


Exchange Server tips, tutorials and expert advice
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


With the release of Exchange Server 2007, some administrators view the Exchange Management Shell (EMS) as a necessary evil. Microsoft omitted several functions from the Exchange Management Console, forcing administrators to perform them from the command line. Performing tasks manually may seem easier; but it can be time consuming if you're dealing with complex or repetitive functions. This tip explains how to use custom cmdlets to automate complex or repetitive functions in Exchange Server 2007.

Memorizing a series of commands may seem strange to Exchange administrators who are accustomed to simply pointing and clicking through Microsoft's GUI. The fact that you can't use the Exchange Management Shell for most common administrative tasks complicates matters further. But there are a few ways in which the EMS can make an Exchange Server 2007 administrator's life easier.

The Exchange Management Shell can automate complicated tasks via the command line using a cmdlet. While it might seem easier to perform the task manually, that may not be the case if it's something you must do on a regular basis. Automating the task may seem time consuming up front, but it saves you time in the long run.

A cmdlet is basically an easy-to-build text file that contains a series of commands. Typically, this text file will use the .PS1 extension, which designates it as a PowerShell cmdlet.

What kind of text does the file contain? Cmdlets can be as simple or as complex as you want. In their simplest form, cmdlets are nothing more than a series of either Windows PowerShell commands or Exchange-specific commands (assuming you're going to run the cmdlet through the Exchange Management Shell). For example, suppose that one of your responsibilities was to generate a monthly report of any Exchange 2007 user who's either a supervisor


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


RELATED CONTENT
Microsoft Exchange Server Scripts and Programming
Removing old disclaimers from Exchange Server 2003
How to run Exchange Management Shell cmdlets in Exchange Server 2007
Exchange event sink scripting error when configuring email disclaimer
EMS add-on tool generates graphical Exchange Server 2007 reports
A primer on the Exchange Server 2007 Exchange Management Shell
How to generate HTML reports with the Exchange Management Shell (EMS)
Use the Exchange Management Shell Set command to block senders
How to test Exchange Management Shell commands
Grant or deny permissions to access a user's Exchange 2007 mailbox
Control query results with Exchange Management Shell's Format command

Microsoft Exchange Server 2007
Virtualizing Exchange Server 2007 -- Where it works
Fixing DPM 2007 inconsistent replica errors in Exchange Server
Using Mobile Device Manager 2008 server roles in Exchange 2007
Relocating Outlook email messages on a hosted Exchange 2007 server
New high availability features in Exchange Server 2010
An introduction to the DSAccess service in Exchange Server 2007
Control Outlook 2007 in cached mode settings with group policies
Exchange Performance Monitor tracks domain controller communication
Meeting Workspaces in Microsoft Office SharePoint Server 2007
Exchange Server 2007 SP2 reinstates built-in backup capabilities
Microsoft Exchange Server 2007 Research

Exchange Server Administration Tips
Fixing DPM 2007 inconsistent replica errors in Exchange Server
Using Mobile Device Manager 2008 server roles in Exchange 2007
An introduction to the DSAccess service in Exchange Server 2007
Exchange Performance Monitor tracks domain controller communication
Exchange Server 2007 SP2 reinstates built-in backup capabilities
Three Performance Monitors counters to use in Exchange Server 2007
Scheduling multiple Performance Monitor alerts in Exchange Server 2007
Which ActiveSync authentication method is best for your mobile device?
Configure Performance Monitor alerts for Exchange Server 2007
Disable ActiveSync in bulk with Exchange Management Shell commands

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
application program interface  (SearchExchange.com)
event sink  (SearchExchange.com)
synchronous groupware  (SearchExchange.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


or a manager. You could do so using the following Exchange Management Shell commands:

Get-User –Filter {(Title –EQ 'Supervisor') –or (Title –EQ 'Manager')} | Export-CSV "C:\report.csv"

This command structure is fairly simple; it obtains a list of users and then filters the list by users who have a title of either Supervisor or Manager. The results are then exported to a .CSV file.

Although this command's function is fairly simple, it involves quite a bit of typing. Furthermore, the command is a bit tedious, so it's easy to make a typing error. If I had to create this type of report each month, I would write a script that saves me from having to type or remember these commands each time.

With a good working knowledge of the Microsoft .NET framework, you can write more complex cmdlets that access classes and objects not exposed through any built-in commands.

About the author: Brien M. Posey, MCSE, is a five-time recipient of Microsoft's Most Valuable Professional award for his work with Exchange Server, Windows Server, Internet Information Services (IIS), and File Systems and Storage. Brien has served as CIO for a nationwide chain of hospitals and was once responsible for the Department of Information Management at Fort Knox. As a freelance technical writer, Brien has written for Microsoft, TechTarget, CNET, ZDNet, MSD2D, Relevant Technologies and other technology companies. You can visit Brien's personal website at www.brienposey.com.

Do you have comments on this tip? Let us know.

Please let others know how useful this tip was via the rating scale below. Do you know a helpful Exchange Server, Microsoft Outlook or SharePoint tip, timesaver or workaround? Email the editors to talk about writing for SearchExchange.com.

Rate this Tip
To rate tips, you must be a member of SearchExchange.com.
Register now to start rating these tips. Log in if you are already a member.




DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Email Server Solutions: Exchange 2007, Exchange 2003, Exchange 2000, SharePoint
HomeNewsTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersIT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2004 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts