Microsoft Exchange 2010 PowerShell Cookbook

Book description

This brilliant Cookbook is packed with step-by-step instructions on writing scripts for Exchange 2010. You'll be able to use the recipes straightaway and take your Microsoft Exchange management capabilities to another level.

  • Step-by-step instructions on how to write scripts for nearly every aspect of Exchange 2010 including the Client Access Server, Mailbox, and Transport server roles
  • Understand the core concepts of Windows PowerShell 2.0 that will allow you to write sophisticated scripts and one-liners used with the Exchange Management Shell
  • Learn how to write scripts and functions, schedule scripts to run automatically, and generate complex reports
  • Rapidly provision and modify recipients in bulk using simple commands

In Detail

Microsoft Exchange Server 2010 is a complex messaging system with many features. In order to ease the burden on IT administrations, Exchange 2010 supports a management architecture built on Windows PowerShell 2.0, called the Exchange Management Shell. Using this management architecture, administrators can gain more efficiency then ever by automating routing tasks through PowerShell scripts and one-liners that save time and eliminate errors.

This focused practical cookbook will show you how to manage and maintain your Microsoft Exchange Server 2010 environment with Windows PowerShell 2.0 and the Exchange Management Shell. It provides recipes for solving common scripting tasks and problems based on real-world scenarios.

The book is full of practical, immediately usable task-based recipes that will enable you to manage and maintain your Microsoft Exchange 2010 environment with Windows PowerShell 2.0 and the Exchange Management Shell. It starts with key PowerShell concepts that lay the foundation for the scripting examples used throughout the book. You will then move on to common Exchange Management Shell tasks, enabling you to get connected to servers, run reports, and automate tasks. The book then takes you on a deep dive into topics such as Managing Recipients, Managing Mailboxes, Distribution Groups and Address Lists, Mailbox and Public Folder Databases, Client Access Servers, Transport and High Availability, amongst others.

Table of contents

  1. Microsoft Exchange 2010 PowerShell Cookbook
    1. Table of Contents
    2. Microsoft Exchange 2010 PowerShell Cookbook
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers and more
        1. Why subscribe?
        2. Free access for Packt account holders
        3. Instant updates on new Packt books
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
      7. Downloading the example code
        1. Errata
        2. Piracy
        3. Questions
    8. 1. PowerShell Key Concepts
      1. Introduction
        1. Performing some basic steps
      2. Understanding command syntax and parameters
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      3. Using the help system
        1. How to do it...
        2. How it works...
        3. There's more...
          1. Getting help with cmdlets and functions
        4. See also
      4. Understanding the pipeline
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      5. Working with variables and objects
        1. How to do it...
        2. How it works...
        3. There's more...
          1. Variable expansion in strings
          2. Strongly typed variables
      6. Formatting output
        1. How to do it...
        2. How it works...
        3. There's more…
        4. See also
      7. Working with arrays and hash tables
        1. How to do it...
        2. How it works...
        3. There's more…
        4. See also
      8. Looping through items
        1. How to do it...
        2. How it works...
        3. There's more…
        4. See also
      9. Using flow control statements
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      10. Creating custom objects
        1. How to do it...
        2. How it works...
        3. There's more...
          1. Watch out for concurrent pipeline errors
        4. See also
      11. Creating PowerShell functions
        1. How to do it...
        2. How it works...
        3. There's more…
          1. Taking it a step further
        4. See also
      12. Creating and running scripts
        1. How to do it...
        2. How it works...
        3. There's more…
          1. Execution policy
        4. See also
      13. Setting up a profile
        1. How to do it...
        2. How it works...
        3. There's more…
        4. See also
    9. 2. Exchange Management Shell Common Tasks
      1. Introduction
        1. Performing some basic steps
      2. Using command discovery through the Exchange Management Console
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      3. Manually configuring remote PowerShell connections
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      4. Transferring files through remote shell connections
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      5. Dealing with concurrent pipelines in remote PowerShell
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      6. Managing domains or an entire forest using recipient scope
        1. How to do it...
        2. How it works...
        3. There's more...
      7. Using explicit credentials with PowerShell cmdlets
        1. How to do it...
        2. How it works...
        3. There's more...
      8. Exporting reports to text and CSV files
        1. How to do it...
        2. How it works...
        3. T here's more...
        4. See also
      9. Sending SMTP e-mails through PowerShell
        1. How to do it...
        2. How it works...
        3. There's more...
          1. Sending messages with attachments
          2. Sending command output in the body of a message
        4. See also
      10. Scheduling scripts to run at a later time
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      11. Logging shell sessions to a transcript
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      12. Automating tasks with the scripting agent
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Using multiple cmdlets with the OnComplete API
        5. See also
      13. Scripting an Exchange server Installation
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
    10. 3. Managing Recipients
      1. Introduction
        1. Performing some basic steps
      2. Adding, modifying, and removing mailboxes
        1. How to do it...
        2. How it works...
        3. There's more...
          1. Setting active directory attributes
        4. See also
      3. Working with contacts
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      4. Managing distribution groups
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      5. Managing resource mailboxes
        1. How to do it...
        2. How it works...
        3. There's more...
          1. Converting mailboxes
        4. See also
      6. Creating recipients in bulk using a CSV file
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Taking it a step further
        5. See also
      7. Working with recipient filters
        1. How to do it...
        2. How it works...
        3. There's more…
          1. Understanding variables in filters
        4. See also
      8. Adding and removing recipient e-mail addresses
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      9. Hiding recipients from address lists
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      10. Configuring recipient moderation
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      11. Configuring message delivery restrictions
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      12. Managing automatic replies and out of office settings for a user
        1. How to do it...
        2. How it works...
        3. There's more...
      13. Adding, modifying, and removing server-side inbox rules
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      14. Managing mailbox folder permissions
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      15. Importing user photos into Active Directory
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more…
          1. Taking it a step further
        5. See also
    11. 4. Managing Mailboxes
      1. Introduction
      2. Performing some basic steps
      3. Reporting on the mailbox size
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      4. Working with move requests and performing mailbox moves
        1. How to do it...
        2. How it works...
        3. There's more...
          1. Removing the move requests
          2. Moving the archive mailboxes
          3. Moving the mailboxes in batches
          4. Moving mailboxes with corrupt items
        4. See also
      5. Importing and exporting mailboxes
        1. How to do it...
        2. How it works...
        3. There's more…
          1. Importing data into mailboxes
          2. Taking it a step further
        4. See also
      6. Deleting messages from mailboxes
        1. How to do it...
        2. How it works...
        3. There's more…
          1. Running reports before deleting data
          2. Deleting messages in bulk
        4. See also
      7. Managing disconnected mailboxes
        1. How to do it...
        2. How it works...
        3. There's more…
        4. See also
      8. Generating mailbox folder reports
        1. How to do it...
        2. How it works...
        3. There's more…
          1. Taking it a step further
        4. See also
      9. Reporting on mailbox creation time
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      10. Checking mailbox logon statistics
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      11. Setting storage quotas for mailboxes
        1. How to do it...
        2. How it works...
        3. There's more...
      12. Finding inactive mailboxes
        1. How to do it...
        2. How it works...
        3. There's more...
      13. Detecting and fixing corrupt mailboxes
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      14. Restoring deleted items from mailboxes
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
    12. 5. Distribution Groups and Address Lists
      1. Introduction
      2. Reporting on distribution group membership
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      3. Adding members to a distribution group from an external file
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      4. Previewing dynamic distribution group membership
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      5. Excluding hidden recipients from a dynamic distribution group
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      6. Converting and upgrading distribution groups
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      7. Allowing managers to modify group membership
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      8. Removing disabled user accounts from distribution groups
        1. How to do it...
        2. How it works...
        3. There's more…
        4. See also
      9. Working with distribution group naming policies
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      10. Working with distribution group membership approval
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      11. Creating address lists
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      12. Exporting address list membership to a CSV file
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      13. Configuring hierarchical address books
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
    13. 6. Mailbox and Public Folder Databases
      1. Introduction
        1. Performing some basic steps
      2. Managing the mailbox and the public folder databases
        1. How to do it...
        2. How it works...
        3. There's more…
          1. Understanding automatic mailbox distribution
        4. See also
      3. Moving databases and logs to another location
        1. How to do it...
        2. How it works...
        3. There's more…
          1. Manually moving databases
          2. Taking it a step further
        4. See also
      4. Configuring the mailbox and public folder database limits
        1. How to do it...
        2. How it works...
        3. There's more…
          1. Taking it a step further
        4. See also
      5. Reporting on mailbox database size
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      6. Finding the total number of mailboxes in a database
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      7. Determining the average mailbox size per database
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      8. Reporting on database backup status
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      9. Restoring data from a recovery database
        1. How to do it...
        2. How it works...
        3. There's more…
          1. Understanding target mailbox identity
          2. Learning about other useful parameters
          3. Understanding mailbox restore request cmdlets
          4. Taking it a step further
        4. See also
      10. Configuring public folder replication
        1. How to do it...
        2. How it works...
        3. There's more...
      11. Managing user access to public folders
        1. How to do it...
        2. How it works...
        3. There's more...
      12. Reporting on public folder statistics
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
    14. 7. Managing Client Access
      1. Introduction
        1. Performing some basic steps
      2. Creating an RPC Client Access array
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      3. Configuring the CAS server used by RPC clients
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      4. Configuring RPC encryption requirements
        1. How to do it.
        2. How it works...
        3. There's more...
        4. See also
      5. Managing ActiveSync, OWA, POP3, and IMAP4 mailbox settings
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      6. Setting internal and external CAS URLs
        1. How to do it...
        2. How it works...
        3. There's more…
          1. Command syntax for the remaining virtual directories
        4. See also
      7. Managing Outlook Anywhere settings
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      8. Blocking Outlook clients from connecting to Exchange
        1. How to do it...
        2. How it works...
        3. There's more…
      9. Reporting on active OWA and RPC connections
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      10. Controlling ActiveSync device access
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      11. Reporting on ActiveSync devices
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
    15. 8. Managing Transport Servers
      1. Introduction
        1. Performing some basic steps
      2. Managing connectors
        1. How to do it...
        2. How it works...
        3. There's more…
        4. See also
      3. Configuring transport limits
        1. How to do it...
        2. How it works...
        3. There's more…
        4. See also
      4. Allowing application servers to relay mail
        1. How to do it...
        2. How it works...
        3. There's more…
        4. See also
      5. Managing transport rules
        1. How to do it...
        2. How it works...
        3. There's more…
          1. Modifying transport rules
          2. Enabling, disabling, and removing transport rules
          3. Understanding regular expressions in transport rules
      6. Working with custom DSN messages
        1. How to do it...
        2. How it works...
        3. There's more…
      7. Managing connectivity and protocol logs
        1. How to do it...
        2. How it works...
        3. There's more…
          1. Parsing logfiles
      8. Message tracking logs
        1. How to do it...
        2. How it works...
        3. There's more…
          1. Taking it a step further
        4. See also
      9. Working with messages in transport queues
        1. How to do it...
        2. How it works...
        3. There's more…
      10. Searching anti-spam agent logs
        1. How to do it...
        2. How it works...
        3. There's more…
        4. See also
      11. Implementing a header firewall
        1. How to do it...
        2. How it works...
        3. There's more...
    16. 9. High Availability
      1. Introduction
        1. Performing some basic steps
      2. Building a Windows NLB cluster for CAS servers
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more…
          1. Taking it a step further
        5. See also
      3. Creating a Database Availability Group
        1. How to do it...
        2. How it works...
        3. There's more…
        4. See also
      4. Adding mailbox servers to a Database Availability Group
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      5. Configuring Database Availability Group network settings
        1. How to do it...
        2. How it works...
        3. There's more…
          1. Renaming and removing DAG networks
      6. Adding mailbox copies to a Database Availability Group
        1. How to do it...
        2. How it works...
        3. There's more…
        4. See also
      7. Activating mailbox database copies
        1. How to do it...
        2. How it works...
        3. There's more…
        4. See also
      8. Working with lagged database copies
        1. How to do it...
        2. How it works...
        3. There's more...
      9. Reseeding a database copy
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      10. Performing maintenance on Database Availability Group members
        1. How to do it...
        2. How it works...
        3. There's more...
      11. Reporting on database status, redundancy, and replication
        1. How to do it...
        2. How it works...
        3. There's more…
          1. Understanding switchover and failover metrics
          2. Understanding Replication Metrics
        4. See also
    17. 10. Exchange Security
      1. Introduction
        1. Performing some basic steps
      2. Granting users full access permissions to mailboxes
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      3. Finding users with full access to mailboxes
        1. How to do it...
        2. How it works...
        3. There's more...
      4. Sending e-mail messages as another user or group
        1. How to do it...
        2. How it works...
        3. There's more...
      5. Working with Role Based Access Control (RBAC)
        1. How to do it...
        2. How it works...
        3. There's more…
          1. RBAC is for end-users too
        4. See also
      6. Creating a custom RBAC role for administrators
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      7. Creating a custom RBAC role for end users
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      8. Troubleshooting Role Based Access Control
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      9. Generating a certificate request
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      10. Installing certificates and enabling services
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      11. Importing certificates on multiple exchange servers
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
    18. 11. Compliance and Audit Logging
      1. Introduction
        1. Performing some basic steps
      2. Managing archive mailboxes
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      3. Configuring archive mailbox quotas
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      4. Creating retention tags and policies
        1. How to do it.
        2. How it works…
        3. There's more…
          1. Understanding default tags
        4. See also
      5. Applying retention policies to mailboxes
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      6. Placing mailboxes on retention hold
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      7. Performing a discovery search
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      8. Placing mailboxes on litigation hold
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      9. Enabling mailbox audit logging
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      10. Generating mailbox audit log reports
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      11. Configuring Administrator Audit Logging
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      12. Searching administrator audit logs
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
    19. 12. Server Monitoring and Troubleshooting
      1. Introduction
        1. Performing some basic steps
      2. Managing and monitoring services
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      3. Verifying server connectivity
        1. How to do it...
        2. How it works...
      4. Working with the event logs
        1. How to do it...
        2. How it works...
        3. There's more...
      5. Reporting on disk usage
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      6. Checking CPU utilization
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      7. Monitoring memory utilization
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      8. Reporting on Exchange Server uptime
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      9. Troubleshooting the Mailbox role
        1. How to do it...
        2. How it works...
        3. See also
      10. Troubleshooting the Client Access Server role
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      11. Troubleshooting Transport servers
        1. How to do it...
        2. How it works...
        3. See also
      12. Verifying certificate health
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
    20. 13. Scripting with the Exchange Web Services Managed API
      1. Introduction
      2. Performing some basic steps
      3. Getting connected to EWS
        1. How to do it...
        2. How it works...
        3. There's more...
        4. Certificates matter
      4. Sending e-mail messages with EWS
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      5. Working with impersonation
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      6. Searching mailboxes
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      7. Retrieving the headers of an e-mail message
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      8. Deleting e-mail items from a mailbox
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      9. Creating calendar items
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      10. Exporting attachments from a mailbox
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
    21. A. Exchange Management Shell reference
      1. Commonly-used shell variables
      2. Commonly-used type accelerators
      3. Scripts available in the $ExBin directory
      4. Properties that can be used with the Filter parameter
      5. Properties that can be used with the RecipientFilterparameter
    22. B. Advanced Query Syntax
      1. Using the word phrase search
        1. Examples
      2. Using a date range search
        1. Examples
      3. Using the message type search
        1. Examples
      4. Using the logical connector search
        1. Examples
    23. Index

Product information

  • Title: Microsoft Exchange 2010 PowerShell Cookbook
  • Author(s): Mike Pfeiffer
  • Release date: July 2011
  • Publisher(s): Packt Publishing
  • ISBN: 9781849682466