Book Image

Microsoft Exchange Server PowerShell Essentials

By : Biswanath Banerjee
Book Image

Microsoft Exchange Server PowerShell Essentials

By: Biswanath Banerjee

Overview of this book

PowerShell has become one of the most important skills in an Exchange administrator's armory. PowerShell has proved its mettle so widely that, if you're not already starting to learn PowerShell, then you're falling behind the industry. It isn't difficult to learn PowerShell at all. In fact, if you've ever run commands from a CMD prompt, then you'll be able to start using PowerShell straightaway. This book will walk you through the essentials of PowerShell in Microsoft Exchange Server and make sure you understand its nitty gritty effectively. You will first walk through the core concepts of PowerShell and their applications. This book discusses ways to automate tasks and activities that are performed by Exchange administrators and that otherwise take a lot of manual effort. Microsoft Exchange PowerShell Essentials will provide all the required details for Active Directory, System, and Exchange administrators to help them understand Windows PowerShell and build the required scripts to manage the Exchange Infrastructure.
Table of Contents (17 chapters)
Microsoft Exchange Server PowerShell Essentials
About the Author
About the Reviewer

Writing an advance script

The following script will ask for inputs from the user and display the distribution group membership report either on the console or redirect it to a CSV file based on the selected option. The full script can be found at the TechNet Script center at written by Satheshwaran Manoharan.

In this script, a Switch statement is used to check two conditions. A few variables and an empty array called $Displayout has been declared, which are used later in the script to store the output that is redirected to a CSV file based on the user's inputs. The New-Object cmdlet is used to create a new instance of the Windows PowerShell object and add the required custom properties using the Add-member cmdlet.

In the second section, the results have been added to the empty array that we have declared $Displayout, which will be piped to the Export-CSV cmdlet to export the output to a CSV file.

Finally, if the script...