Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
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
R$50 per month
Full star icon Full star icon Full star icon Full star icon Full star icon 5 (4 Ratings)
Paperback Jul 2015 464 pages 1st Edition
eBook
R$80 R$294.99
Paperback
R$367.99
Subscription
Free Trial
Renews at R$50p/m
Arrow left icon
Profile Icon Andersson Profile Icon Mike Pfeiffer
Arrow right icon
R$50 per month
Full star icon Full star icon Full star icon Full star icon Full star icon 5 (4 Ratings)
Paperback Jul 2015 464 pages 1st Edition
eBook
R$80 R$294.99
Paperback
R$367.99
Subscription
Free Trial
Renews at R$50p/m
eBook
R$80 R$294.99
Paperback
R$367.99
Subscription
Free Trial
Renews at R$50p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
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 : 9781785288074
Vendor :
Microsoft

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

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

Packt Subscriptions

See our plans and pricing
Modal Close icon
R$50 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
R$500 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 R$25 each
Feature tick icon Exclusive print discounts
R$800 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 R$25 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total R$ 947.97
Windows Server 2012 R2 Administrator Cookbook
R$306.99
Active Directory with PowerShell
R$272.99
Microsoft Exchange Server Powershell Cookbook (Update)
R$367.99
Total R$ 947.97 Stars icon

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

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.