- Microsoft Exchange Server PowerShell Cookbook(Third Edition)
- Jonas Andersson Mike Pfeiffer
- 2156字
- 2021-07-16 13:26:31
Preface
This book is full of immediately usable task-based recipes for managing and maintaining your Microsoft Exchange 2013 environment with Windows PowerShell 5.0 and the Exchange Management Shell. The focus of this book is to show you how to automate routine tasks and solve common problems. While the Exchange Management Shell literally provides hundreds of cmdlets, we will not cover every single one of them inpidually. Instead, we’ll focus on the common, real-world scenarios. You’ll be able to leverage these recipes right away, allowing you to get the job done quickly, and the techniques that you’ll learn will allow you to write your own amazing commands and scripts with ease.
What this book covers
Chapter 1, PowerShell Key Concepts, introduces several PowerShell core concepts, such as command syntax and parameters, working with the pipeline, loops, and conditional logic. The topics covered in this chapter lay the foundation for the remaining code samples in each chapter.
Chapter 2, Exchange Management Shell Common Tasks, covers day-to-day tasks and general techniques for managing Exchange from the command line. The topics include configuring manual remote shell connections, exporting reports to external files, sending e-mail messages from scripts, and scheduling scripts to run with the Task Scheduler.
Chapter 3, Managing Recipients, demonstrates some of the most common recipient-related management tasks, such as creating mailboxes, distribution groups, and contacts. You’ll also learn how to manage server-side inbox rules, Out of Office settings, and import user photos into Active Directory.
Chapter 4, Managing Mailboxes, shows you how to perform various mailbox management tasks that include moving mailboxes, importing and exporting mailbox data, and the detection and reparation of corrupt mailboxes. In addition, you’ll learn how to delete and restore items from a mailbox and manage the new public folders.
Chapter 5, Distribution Groups and Address Lists, takes you deeper into distribution group management. The topics include distribution group reporting, distribution group naming policies, and allowing end users to manage distribution group membership. You’ll also learn how to create Address Lists and Hierarchal Address Books.
Chapter 6, Mailbox Database Management, shows you how to set database settings and limits. Report generation for mailbox database size, average mailbox size per database, and backup status is also covered in this chapter.
Chapter 7, Managing Client Access, covers the management of ActiveSync, OWA, POP, and IMAP. It also covers the configuration of these components in Exchange 2013. We’ll also take a look at controlling connections from various clients, including ActiveSync devices.
Chapter 8, Managing Transport Servers, explains the various methods used to control the mail flow within your Exchange organization. You’ll learn how to create, send, and receive connectors, allow application servers to relay mail, and manage transport queues.
Chapter 9, High Availability, covers the implementation and management tasks related to Database Availability Groups. The topics include creating DAGs, adding mailbox database copies, and performing maintenance on DAG members. It also covers a new feature called Automatic Reseed.
Chapter 10, Exchange Security, introduces you to the new Role Based Access Control permissions model. You’ll learn how to create custom RBAC roles for administrators and end users, and also how to manage mailbox permissions and implement SSL certificates.
Chapter 11, Compliance and Audit Logging, covers the new compliance and auditing features included in Exchange 2013. Topics such as archiving mailboxes and discovery search are covered here, as well as administrator and mailbox audit logging.
Chapter 12, Scripting with the Exchange Web Services Managed API, introduces you to advanced scripting topics that leverage Exchange Web Services. In this chapter, you’ll learn how to write scripts and functions that go beyond the capabilities of the Exchange Management Shell cmdlets.
Appendix A, Common Shell Information, is a reference for the variables, scripts, and the filtering functions. These references will help you when writing scripts or running interactive scripts.
Appendix B, Query Syntaxes, is a reference for the Advanced Query Syntax. In this section, you will find lots of different examples that can be used in the real world.
What you need for this book
To complete the recipes in this book, you’ll need the following:
- PowerShell v5, which is already installed by default on Windows 8.1 and Windows Server 2012 R2.
- A fully operational lab environment with an Active Directory forest and Exchange organization.
- Ideally, your Exchange Servers will run Windows Server 2012 R2, but they can run Windows Server 2008 R2, if needed.
- You’ll need to have at least one Microsoft Exchange 2013 server.
- It is assumed that the account you are using is a member of the Organization Management role group. The user account used to install Exchange 2013 is automatically added to this group.
- If possible, you’ll want to run the commands, scripts, and functions in this book from a client machine. The 64-bit version of Windows 8.1 with the Exchange 2013 Management Tools installed is a good choice. You can also run the tools on Windows 7. Each client will need some additional prerequisites in order to run the tools; see Microsoft’s TechNet documentation for complete details.
- If you don’t have a client machine, you can run the Exchange Management Shell from an Exchange 2013 server.
- Chapter 12, Scripting with the Exchange Web Services Managed API, requires the Exchange Web Services Managed API Version 2.2, which can be downloaded from http://www.microsoft.com/en-us/download/details.aspx?id=42951.
The code samples in this book should be run in a lab environment and fully tested before deployed into production. If you don’t have a lab environment set up, the software can be downloaded from http://technet.microsoft.com/en-us/exchange/. Then, build the servers on your preferred virtualization engine.
Who this book is for
This book is for messaging professionals who want to learn how to build real-world scripts with Windows PowerShell 5.0 and the Exchange Management Shell. If you are a network or systems administrator responsible for managing and maintaining the on-premises version of Exchange Server 2013, then this book is for you.
The recipes in this Cookbook touch on each of the core Exchange 2013 server roles, and require a working knowledge of the supporting technologies, such as Windows Server 2008 R2, 2012 or 2012 R2, Active Directory, and DNS.
All of the topics in this book are focused on the on-premises version of Exchange 2013, and we will not cover Microsoft’s hosted version of Exchange Online through Office 365. However, the concepts you’ll learn in this book will allow you to hit the ground running with that platform since it will give you an understanding of PowerShell’s command syntax and object-based nature.
Sections
In this book, you will find several headings that appear frequently (Getting ready, How to do it, How it works, There’s more, and See also).
To give clear instructions on how to complete a recipe, we use these sections as follows:
Getting ready
This section tells you what to expect in the recipe, and describes how to set up any software or any preliminary settings required for the recipe.
How to do it…
This section contains the steps required to follow the recipe.
How it works…
This section usually consists of a detailed explanation of what happened in the previous section.
There’s more…
This section consists of additional information about the recipe in order to make the reader more knowledgeable about the recipe.
See also
This section provides helpful links to other useful information for the recipe.
Conventions
In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text are shown as follows:
“We can read the content of an external file into the shell using the Get-Content
cmdlet”
Commands and blocks of code are set as follows:
Get-Mailbox –ResultSize Unlimited | Out-File C:\report.txt
Commands like this can be invoked interactively in the shell, or from within a script or function.
Most of the commands you’ll be working with will be very long. In order for them to fit into the pages of this book, we’ll need to use line continuation. For example, the following is a command that creates a mailbox:
New-Mailbox -UserPrincipalName jsmith@contoso.com ` -FirstName John ` -LastName Smith ` -Alias jsmith ` -Database DB1 ` -Password $password
Notice that the last character on each line is the backtick (`) symbol, also referred to as the grave accent. This is PowerShell’s line continuation character. You can run this command as is, but make sure there aren’t any trailing spaces at the end of each line. You can also remove the backtick and carriage returns and run the command on one line. Just ensure the spaces between the parameters and arguments are maintained.
You’ll also see long pipeline commands formatted like the following example:
Get-Mailbox -ResultSize Unlimited | Select-Object DisplayName,ServerName,Database | Export-Csv c:\mbreport.csv -NoTypeInformation
PowerShell uses the pipe character (|) to send objects output from a command down the pipeline so it can be used as input by another command. The pipe character does not need to be escaped. You can enter the previous command as is, or you can format the command so that everything is on one line.
Any command-line input or output that must be done interactively at the shell console is written as follows:
[PS] C:\>Get-Mailbox administrator | ft ServerName,Database -Auto ServerName Database ---------- -------- mbx1 DB01
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: “When a user logs into ECP, the very first thing they see is the Account Information screen”.
Note
Warnings or important notes appear in a box like this.
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.
To send us general feedback, simply e-mail <feedback@packtpub.com>
, and mention the book’s title in the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
Downloading the example code
You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
Downloading the color images of this book
We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from http://www.packtpub.com/sites/default/files/downloads/8074EN_ColorImages.pdf.
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.
To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.
Piracy
Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <copyright@packtpub.com>
with a link to the suspected pirated material.
We appreciate your help in protecting our authors and our ability to bring you valuable content.
Questions
If you have a problem with any aspect of this book, you can contact us at <questions@packtpub.com>
, and we will do our best to address the problem.
- Mastering OpenLayers 3
- Spring Boot+Spring Cloud+Vue+Element項目實戰:手把手教你開發權限管理系統
- Learning Salesforce Einstein
- Python數據結構與算法(視頻教學版)
- Building Machine Learning Systems with Python(Second Edition)
- Essential C++(中文版)
- Mastering AWS Security
- Zabbix Performance Tuning
- 多媒體技術及應用
- Mastering Concurrency in Python
- 快樂編程:青少年思維訓練
- MATLAB 2020 GUI程序設計從入門到精通
- 從“1”開始3D編程
- Mastering Object:Oriented Python(Second Edition)
- Daniel Arbuckle's Mastering Python