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 Powershell Cookbook (Update)
Microsoft Exchange Server Powershell Cookbook (Update)

Microsoft Exchange Server Powershell Cookbook (Update): Over 120 recipes to help you manage and administrate Exchange Server 2013 Service Pack 1 with PowerShell 5

Arrow left icon
Profile Icon Andersson Profile Icon Mike Pfeiffer
Arrow right icon
S$12.99 S$71.99
Full star icon Full star icon Full star icon Full star icon Full star icon 5 (4 Ratings)
eBook Jul 2015 464 pages 1st Edition
eBook
S$12.99 S$71.99
Paperback
S$88.99
Subscription
Free Trial
Arrow left icon
Profile Icon Andersson Profile Icon Mike Pfeiffer
Arrow right icon
S$12.99 S$71.99
Full star icon Full star icon Full star icon Full star icon Full star icon 5 (4 Ratings)
eBook Jul 2015 464 pages 1st Edition
eBook
S$12.99 S$71.99
Paperback
S$88.99
Subscription
Free Trial
eBook
S$12.99 S$71.99
Paperback
S$88.99
Subscription
Free Trial

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 Powershell Cookbook (Update)

Chapter 2. Exchange Management Shell Common Tasks

In this chapter, we will cover the following topics:

  • Manually configuring remote PowerShell connections
  • Using explicit credentials with PowerShell cmdlets
  • Transferring files through remote shell connections
  • Managing domains or an entire forest using the recipient scope
  • Exporting reports to text and CSV files
  • Sending SMTP e-mails 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 v1, 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, with Exchange 2013, PowerShell Version 3 was used, but now when using PowerShell Version 5 together with cumulative updates, there are a lot of new cmdlets, core...

Manually configuring remote PowerShell connections

Just like Exchange 2010, Exchange 2013 is very reliable on remote PowerShell for both on-premises and cloud services. When you double-click on 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 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 need to log on to a workstation or a server and launch Windows PowerShell.

How to do it...

Let's see how to manually configure remote PowerShell connections, using the following steps:

  1. First, create a credential object using the Get-Credential cmdlet. When running this...

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 e-mail messages, working in cross-forest scenarios, and many 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:

$credential = Get-Credential
Get-Mailbox -Credential $credential

How it works...

When you run the Get-Credential cmdlet, you are presented with a Windows authentication dialog box requesting your username and password. In the previous example, we assigned the Get-Credential...

Transferring files through remote shell connections

Since the Exchange 2013 Management Shell commands are executed through a remote PowerShell session, importing and exporting files require a new special syntax. There are a handful of shell cmdlets that require this. 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 client access server. We can import the file using the Get-Content cmdlet, using a syntax similar to the following:

[byte[]]$data = Get-Content -Path ".\ExportedCert.pfx" ` -Encoding Byte ` -ReadCount 0
$password = Get-Credential
Import-ExchangeCertificate –FileData $data –Password 
$password.Password

In this example, the file data is first read into a variable called $data. The certificate import is done using the Import-ExchangeCertificate cmdlet by assigning the $data variable as a value to the ...

Managing domains or an entire forest using the 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 the 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...

Let's see how to manage domains using the recipient scope using the following steps:

  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 sales OU in the contoso.com domain, use the following command:
    Set-AdServerSettings -RecipientViewRoot contoso.com/sales
    
  2. We can also specify the value using the distinguished name...

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 how to export 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...

To export command output to a text file, use the Out-File cmdlet. 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,Alias | Out-File c:\report.txt

You can also save the output of the previous command as a CSV file that can then be opened and formatted in Microsoft Excel:

Get-Mailbox | Select-Object Name,Alias | ` Export-CSV c:\report.csv –NoType

How it works...

The Out-File cmdlet...

Introduction


Microsoft introduced some radical architectural changes in Exchange 2007, including a brand new set of management tools. PowerShell v1, 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, with Exchange 2013, PowerShell Version 3 was used, but now when using PowerShell Version 5 together with cumulative updates, there are a lot of new cmdlets, core functionality...

Manually configuring remote PowerShell connections


Just like Exchange 2010, Exchange 2013 is very reliable on remote PowerShell for both on-premises and cloud services. When you double-click on 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 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 need to log on to a workstation or a server and launch Windows PowerShell.

How to do it...

Let's see how to manually configure remote PowerShell connections, using the following steps:

  1. First, create a credential object using the Get-Credential cmdlet. When running this command, you...

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 e-mail messages, working in cross-forest scenarios, and many 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:

$credential = Get-Credential
Get-Mailbox -Credential $credential

How it works...

When you run the Get-Credential cmdlet, you are presented with a Windows authentication dialog box requesting your username and password. In the previous example, we assigned the Get-Credential...

Transferring files through remote shell connections


Since the Exchange 2013 Management Shell commands are executed through a remote PowerShell session, importing and exporting files require a new special syntax. There are a handful of shell cmdlets that require this. 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 client access server. We can import the file using the Get-Content cmdlet, using a syntax similar to the following:

[byte[]]$data = Get-Content -Path ".\ExportedCert.pfx" ` -Encoding Byte ` -ReadCount 0
$password = Get-Credential
Import-ExchangeCertificate –FileData $data –Password 
$password.Password

In this example, the file data is first read into a variable called $data. The certificate import is done using the Import-ExchangeCertificate cmdlet by assigning the $data variable as a value to the –FileData parameter.

How it works.....

Managing domains or an entire forest using the 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 the 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...

Let's see how to manage domains using the recipient scope using the following steps:

  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 sales OU in the contoso.com domain, use the following command:

    Set-AdServerSettings -RecipientViewRoot contoso.com/sales
    
  2. We can also specify the value using the distinguished name of the...

Left arrow icon Right arrow icon

Description

This book is for messaging professionals who want to build real-world scripts with Windows PowerShell 5 and the Exchange Management Shell. If you are a network or systems administrator responsible for managing and maintaining Exchange Server 2013, you will find this highly useful.

Who is this book for?

This book is for messaging professionals who want to build real-world scripts with Windows PowerShell 5 and the Exchange Management Shell. If you are a network or systems administrator responsible for managing and maintaining Exchange Server 2013, you will find this highly useful.

What you will learn

  • New features and capabilities of PowerShell 5 and Exchange Server 2013 SP1
  • Get to grips with the core PowerShell concepts required to master the Exchange Management Shell, such as pipelining, working with objects, formatting output, and writing scripts
  • Use simple PowerShell scripts and commands to get powerful effects
  • Generate detailed reports, send the output of commands in email messages, and schedule scripts to run automatically
  • Import, export, 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 folder databases

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jul 29, 2015
Length: 464 pages
Edition : 1st
Language : English
ISBN-13 : 9781785281181
Vendor :
Microsoft

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 29, 2015
Length: 464 pages
Edition : 1st
Language : English
ISBN-13 : 9781785281181
Vendor :
Microsoft

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.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
$199.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 S$6 each
Feature tick icon Exclusive print discounts
$279.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 S$6 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total S$ 230.97
Windows Server 2012 R2 Administrator Cookbook
S$74.99
Active Directory with PowerShell
S$66.99
Microsoft Exchange Server Powershell Cookbook (Update)
S$88.99
Total S$ 230.97 Stars icon
Banner background image

Table of Contents

15 Chapters
1. PowerShell Key Concepts Chevron down icon Chevron up icon
2. Exchange Management Shell Common Tasks Chevron down icon Chevron up icon
3. Managing Recipients Chevron down icon Chevron up icon
4. Managing Mailboxes Chevron down icon Chevron up icon
5. Distribution Groups and Address Lists Chevron down icon Chevron up icon
6. Mailbox Database Management Chevron down icon Chevron up icon
7. Managing Client Access Chevron down icon Chevron up icon
8. Managing Transport Servers Chevron down icon Chevron up icon
9. High Availability Chevron down icon Chevron up icon
10. Exchange Security Chevron down icon Chevron up icon
11. Compliance and Audit Logging Chevron down icon Chevron up icon
12. Scripting with the Exchange Web Services Managed API Chevron down icon Chevron up icon
A. Common Shell Information Chevron down icon Chevron up icon
B. Query Syntaxes Chevron down icon Chevron up icon
Index 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
(4 Ratings)
5 star 100%
4 star 0%
3 star 0%
2 star 0%
1 star 0%
Mark James Andrews Sep 04, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Really great book. Full of good insights and examples for anyone who is managing and working with and Exchange Server. The ability to leverage PowerShell and scripting to do do this function is a key role improvement for any IT professional.
Amazon Verified review Amazon
BoggyJoe Sep 14, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I'll start by saying I originally bought the Microsoft Exchange 2010 PowerShell Cookbook a few years ago after it was recommended by a MS consultant that had visited for an Microsoft Exchange Server Risk Assessment and Health Check Program (ExRAP). I had known little about Powershell at the time. I found it to be very helpful and it completely increased my productivity with simple tasks like creating or moving multiple mailboxes, altering access, adding groups, etc.Flash forward to today and this 3rd edition. Still has the same excellent break down and sections dealing with specific admin aspects that you would need day to day. This update has the newer commands, of course. Managing mailboxes/recipients/client access/transport services, Security, HA. Having perfect examples for each task is great so that you can copy and edit them to use. Great time saver and makes finding what you need very easy.
Amazon Verified review Amazon
michael phipps Nov 14, 2016
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Excellent Book well worth it
Amazon Verified review Amazon
crecode Apr 17, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Just what the doctor ordered. PowerShell is powerful and a working knowledge is required for management of Exchange. This book helps you learn PowerShell and at the same time gives you the recipes for accomplishing many day to day management tasks. A MUST!
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.