Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Microsoft Exchange Server 2016 PowerShell Cookbook
Microsoft Exchange Server 2016 PowerShell Cookbook

Microsoft Exchange Server 2016 PowerShell Cookbook: Powerful recipes to automate time-consuming administrative tasks , Fourth Edition

Arrow left icon
Profile Icon Mota Profile Icon Nuno Filipe M Mota Profile Icon Mike Pfeiffer Profile Icon Andersson
Arrow right icon
AU$14.99 AU$72.99
Full star icon Full star icon Full star icon Full star icon Full star icon 5 (1 Ratings)
eBook Jul 2017 648 pages 4th Edition
eBook
AU$14.99 AU$72.99
Paperback
AU$90.99
Subscription
Free Trial
Renews at AU$24.99p/m
Arrow left icon
Profile Icon Mota Profile Icon Nuno Filipe M Mota Profile Icon Mike Pfeiffer Profile Icon Andersson
Arrow right icon
AU$14.99 AU$72.99
Full star icon Full star icon Full star icon Full star icon Full star icon 5 (1 Ratings)
eBook Jul 2017 648 pages 4th Edition
eBook
AU$14.99 AU$72.99
Paperback
AU$90.99
Subscription
Free Trial
Renews at AU$24.99p/m
eBook
AU$14.99 AU$72.99
Paperback
AU$90.99
Subscription
Free Trial
Renews at AU$24.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Microsoft Exchange Server 2016 PowerShell Cookbook

Exchange Management Shell Common Tasks

In this chapter, we will cover:

  • Manually configuring remote PowerShell connections
  • Using explicit credentials with PowerShell cmdlets
  • Transferring files through remote shell connections
  • Managing domains or an entire forest using a recipient scope
  • Exporting reports to text and CSV files
  • Sending SMTP emails through PowerShell
  • Scheduling scripts to run at a later time
  • Logging shell sessions to a transcript
  • Automating tasks with the scripting agent
  • Scripting an Exchange Server installation

Introduction

Microsoft introduced some radical architectural changes in Exchange 2007, including a brand-new set of management tools. PowerShell, along with an additional set of Exchange Server specific cmdlets, finally gave administrators an interface that could be used to manage the entire product from a command line shell. This was an interesting move, and at that time the entire graphical management console was built on top of this technology.

The same architecture still existed with Exchange 2010, and PowerShell was even more tightly integrated with this product. Exchange 2010 used PowerShell v2, which relied heavily on its new remoting infrastructure. This provides seamless administrative capabilities from a single seat with the Exchange Management Tools, whether your servers are on-premises or in the cloud.

Initially when Exchange 2013 was released, it was using version...

Manually configuring remote PowerShell connections

Just like Exchange 2013, Exchange 2016 is very reliant on remote PowerShell for both on-premises and cloud services. When you double-click the Exchange Management Shell shortcut on a server or workstation with the Exchange Management Tools installed, you are connected to an Exchange server using a remote PowerShell session.

PowerShell remoting also allows you to remotely manage your Exchange servers from a workstation or a server even when the Exchange Management Tools are not installed. In this recipe, we'll create a manual remote shell connection to an Exchange server using a standard PowerShell console.

Getting ready

To complete the steps in this recipe, you'll...

Using explicit credentials with PowerShell cmdlets

There are several PowerShell and Exchange Management Shell cmdlets that provide a credential parameter that allows you to use an alternate set of credentials when running a command. You may need to use alternate credentials when making manual remote shell connections, sending email messages, working in cross-forest scenarios, and more. In this recipe, we'll take a look at how you can create a credential object that can be used with commands that support the -Credential parameter.

How to do it...

To create a credential object, we can use the Get-Credential cmdlet. In this example, we store the credential object in a variable that can be used by the Get-Mailbox cmdlet:

...

Transferring files through remote shell connections

Since the Exchange 2016 Management Shell commands are executed through a remote PowerShell session, importing and exporting files requires a new special syntax. There are a handful of shell cmdlets that require this, and, in this recipe, we'll take a look at the syntax that needs to be used to transfer files through a remote shell connection.

How to do it...

Let's say that we are about to import a certificate to the Exchange server, more specifically the client access services. We can import the file using the Get-Content cmdlet, using syntax similar to the following:

    [byte[]]$data = Get-Content -Path ".\ExportedCert.pfx" `
    -Encoding Byte `
  ...

Managing domains or an entire forest using a recipient scope

The Exchange Management Tools can be configured to use specific portions of your Active Directory hierarchy using a specific recipient scope. When you set the recipient scope to a location in Active Directory, such as a domain or an organizational unit, the Exchange Management Shell will only allow you to view the recipients that are stored in that location and any containers beneath it. In this recipe, we'll look at how to set the recipient scope when working with the Exchange Management Shell.

How to do it...

  1. We can set the recipient scope in the Exchange Management Shell using the Set-AdServerSettings cmdlet. For example, to set the recipient scope to the...

Exporting reports to text and CSV files

One of the added benefits of the Exchange Management Shell is the ability to run very detailed and customizable reports. With the hundreds of Get-* cmdlets provided between Windows PowerShell and the Exchange Management Shell, the reporting capabilities are almost endless. In this recipe, we'll cover exporting command output to plain text and CSV files that can be used to report on various resources throughout your Exchange environment.

How to do it...

  1. To export command output to a text file, use the Out-File cmdlet.
  2. To generate a report of mailboxes in a specific mailbox database that can be stored in a text file, use the following command:
    Get-Mailbox | Select-Object Name...

Sending SMTP emails through PowerShell

As an Exchange administrator, you will probably need an automated solution for sending emails from your PowerShell scripts. Whether it's for sending notifications to users in a specific database or emailing the output of your scripts to a reporting mailbox, the transmission of messages like these will prove very useful in performing common day-to-day administrative scripting tasks. In this recipe, we'll take a look at how you can send SMTP email messages from PowerShell to the recipients in your Exchange organization.

How to do it...

PowerShell v2 and later includes a core cmdlet that can be used to send email messages through SMTP to one or more recipients. Use the following...

Scheduling scripts to run at a later time

One of the most common tasks that Exchange administrators perform is scheduling scripts to run at a later time. This can be useful when performing maintenance after hours or running monitoring scripts on a regular basis. In this recipe, you'll learn how to schedule your PowerShell scripts to run with the Windows Task Scheduler. In PowerShell version 4, we got some powerful new cmdlets for managing the Windows Task Scheduler.

Open the Exchange Management Shell by clicking the Windows button and go to Microsoft Exchange Server 2016 and choose Exchange Management Shell.

How to do it...

To create a scheduled task that runs from one of your Exchange servers perform the following steps...

Logging shell sessions to a transcript

You may find it useful at times to record the output of your shell sessions in a log file. This can help you save the history of all the commands you've executed and determine the success or failure of automated scripts. In this recipe, you'll learn how to create a PowerShell transcript. An example of when this could be useful is if we are developing a script and about to implement it in a production environment. It would be neat to use transcript logging during the first run(s).

How to do it...

  1. To create a transcript, execute the Start-Transcript cmdlet:
    Start-Transcript c:\logfile.txt  
  1. You can stop recording the session using the Stop-Transcript cmdlet:
    Stop...

Automating tasks with the scripting agent

The scripting agents were introduced in Exchange 2010 and still remain in Exchange 2016. The concept of cmdlet extension agents is to extend the functionality of the Exchange Management Tools. The scripting extension agent can be used to trigger custom commands as changes are being made by administrators from the management console or the shell. In this recipe, we'll take a look at how to use the scripting agent to automate a task in the Exchange Management Shell.

Getting ready

To complete the steps in the recipe, you'll need to create an XML file. You can simply use Notepad or any XML editor of your choice.

...

Scripting an Exchange server installation

If you are performing mass deployment of Exchange servers in a large environment, automating the installation process can minimize administrator errors and speed up the overall process. The setup.exe utility can be used to perform an unattended installation of Exchange, and, when combined with PowerShell and just a little bit of scripting logic, create a fairly sophisticated installation script. This recipe will provide a couple of examples that can be used to script the installation of an Exchange server.

Getting ready

You can use a standard PowerShell console from the server to run the scripts in this recipe.

...
Left arrow icon Right arrow icon

Key benefits

  • • Learn to integrate PowerShell with Exchange Server 2016
  • • Write scripts and functions to run tasks automatically, and generate complex reports with PowerShell
  • • Use these effective recipes to learn all popular and important PowersShell scripts to manage tasks and avoid errors

Description

We start with a set of recipes on core PowerShell concepts. This will provide you with a foundation for the examples in the book. Next, you'll see how to implement some of the common exchange management shell tasks, so you can effectively write scripts with this latest release. You will then learn to manage Exchange recipients, automate recipient-related tasks in your environment, manage mailboxes, and understand distribution group management within the Exchange Management Shell. Moving on, we'll work through several scenarios where PowerShell scripting can be used to increase your efficiency when managing databases, which are the most critical resources in your Exchange environment. Towards the end, you'll discover how to achieve Exchange High Availability and how to secure your environment, monitor the health of Exchange, and integrate Exchange with Office Online Server, Skype for Business Server, and Exchange Online (Office 365). By the end of the book, you will be able to perform administrative tasks efficiently.

Who is this book for?

This book is for messaging professionals who want to build real-world scripts with Windows PowerShell and the Exchange Management Shell. You'll also find it indispensable if you're a network or systems administrator responsible for managing and maintaining Exchange Server 2016.

What you will learn

  • •Master the new features and capabilities of PowerShell and Exchange Server 2016
  • •Get to grips with the core PowerShell concepts
  • •Use simple PowerShell scripts and commands to get powerful results
  • •Generate detailed reports, send the output of commands by email , and schedule scripts to run automatically
  • •Import, export, and move mailboxes, and delete messages from mailboxes using the command line
  • •Configure transport server settings such as mail relay, tracking logs, transport rules, delivery reports, and more
  • •Manage mailbox and public folders
  • •Monitor the health of an Exchange environment through built-in cmdlets and other methods
  • •Integrate Exchange with Office Online Server, Skype for Business Server, and Exchange Online (Office 365)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jul 14, 2017
Length: 648 pages
Edition : 4th
Language : English
ISBN-13 : 9781787287655
Vendor :
Microsoft
Languages :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Jul 14, 2017
Length: 648 pages
Edition : 4th
Language : English
ISBN-13 : 9781787287655
Vendor :
Microsoft
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
AU$24.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
AU$249.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just AU$5 each
Feature tick icon Exclusive print discounts
AU$349.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just AU$5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total AU$ 249.97
Microsoft Exchange Server 2016 PowerShell Cookbook
AU$90.99
Windows Server 2016 Automation with PowerShell Cookbook
AU$90.99
Mastering Windows PowerShell Scripting (Second Edition)
AU$67.99
Total AU$ 249.97 Stars icon
Banner background image

Table of Contents

16 Chapters
PowerShell Key Concepts Chevron down icon Chevron up icon
Exchange Management Shell Common Tasks Chevron down icon Chevron up icon
Managing Recipients Chevron down icon Chevron up icon
Managing Mailboxes Chevron down icon Chevron up icon
Distribution Groups and Address Lists Chevron down icon Chevron up icon
Mailbox Database Management Chevron down icon Chevron up icon
Managing Client Access Chevron down icon Chevron up icon
Managing Transport Servers Chevron down icon Chevron up icon
Exchange Security Chevron down icon Chevron up icon
Compliance and Audit Logging Chevron down icon Chevron up icon
High Availability Chevron down icon Chevron up icon
Monitoring Exchange Health Chevron down icon Chevron up icon
Integration Chevron down icon Chevron up icon
Scripting with the Exchange Web Services Managed API Chevron down icon Chevron up icon
Common Shell Information Chevron down icon Chevron up icon
Query Syntaxes Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Full star icon 5
(1 Ratings)
5 star 100%
4 star 0%
3 star 0%
2 star 0%
1 star 0%
Steve Oct 31, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I bought this book to help me figure out how to do things I knew how to do in previous versions of Exchange. I knew where to find and how to do things in Exchange 2003, however, things drastically changed with 2007 and forward. Even though this book is for Exchange 2016, I have not found any of the recipes that do not return results as expected in an Exchange 2013 server environment yet. I highly recommend this book to anyone looking for quick reference to “how do I….” I would recommend this book to everyone.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.