Practical PowerShell: Security and Compliance Center
Minimum price
Suggested price

Practical PowerShell: Security and Compliance Center

About the Book


Some books claim to cover it all and cover it in depth, but they rarely succeed at both goals. This book is completely focused on PowerShell for Purview and Defender for Office, and PowerShell is covered in depth! Interested? Read on! Not only is the book focused on and deep dive into PowerShell for Exchange Online, but all content is also practical, focused on real-world scenarios and knowledge gained through experience.

Updates Throughout the Year

Changes are natural in the world of cloud computing, and Purview / Defender for Office is no different. PowerShell that we use to manage it also changes over the course of weeks, months, and years. To help you deal with this, we update our book frequently with the latest topics, content, and PowerShell cmdlets. If the module for Exchange Online is updated to v4, we will cover those changes as well and if a connected service like Exchange changes, we'll cover that as well.

Cloud Changes

The book is written and maintained by Microsoft Most Valuable Professionals (MVPs) who specialize in Purview / Defender for Office and PowerShell and cover the topics expertly. We watch Microsoft for changes in PowerShell (monitoring cmdlets available) to their Roadmap and Message Center so you don't have to. We cover as many changes as we can in each update. As the book is always up to date, Purview / Defender for Office is unlike any printed professional reference book you have used in the past.

This book is aimed at those who know some PowerShell or are looking for ways to make their scripts better as well as help you become more confident in managing Exchange Server with PowerShell.

What’s Covered

  • What’s New
  • PowerShell Basics
  • Beyond the Basics
  • Connecting with PowerShell
  • Identity Management
  • Security
  • Alerting
  • Defender for Office 365
  • Submissions
  • Threats and Mail Flow
  • Compliance
  • Communication Compliance
  • Data Loss Prevention
  • Device Management
  • Information Barriers
  • Insider Risk Management
  • Labels
  • Privacy Management
  • Building Scripts
  • Reporting
  • Troubleshooting
  • Best Practices


This book has the following Chapters in which we cover a range of subjects relating to PowerShell:

1. PowerShell Basics: Used as a launching platform for PowerShell, this Basics chapter introduces you to PowerShell topics to help new PowerShell users understand PowerShell in relation to Purview and Defender for Office. Coverage includes variables, arrays, hash tables, loops, and more. Examples are geared towards Exchange Online to help with relevancy.

2. Beyond the Basics: Continuing on your PowerShell journey, we now cover more advanced topics like formatting your output, understanding data handling, and other helpful tips for moving forward with PowerShell and Purview / Defender for Office.

3. Connecting with PowerShell: This is a simple topic that can be complicated by Microsoft's changes. We cover the various methods for connecting to Purview / Defender for Office and also discuss some of the nuances of the new v3 Exchange module.

4. Connecting to Exchange Online PowerShell: This is a simple topic that can be complicated by Microsoft's changes. We cover the various methods for connecting to Exchange Online and also discuss some of the nuances of the new v3 module.

5. Identity Management: Identity is the key in Microsoft 365 because, without it, users nor administrators will have access to Exchange Online. This chapter dives into how to handle identities in Exchange Online and hybrid identities synced from an on-premises Active Directory.

6. Security: Security and access management are important to any service provided by an enterprise. PowerShell can be used to manage Roles and RBAC your tenant.

7. Alerting: Alerts are key to an administrator's awareness of their environment; we explore how to configure these with PowerShell.

8. Defender for Office: Message hygiene and protection of end-user mailboxes are important aspects of this book, and we cover using PowerShell to manage settings, phishing sims, filtering, and more. External script analysis is also covered.

9. Submissions: When a user or administrator receives a malicious email, they can report these messages. PowerShell can be used to manage and monitor this feature.

10. Threats and Mail Flow: This chapter covers reporting and managing certain aspects of a tenant, from Investigations to Explorers to Campaigns and more.

11. Compliance: Compliance Case are maintained in either the Defender portal or in the PowerShell module for Defender for Office. We cover how to create, remove, modify and more for these cases.

12. Communication Compliance: Controlling mail flow sometimes requires monitoring internal emails and Communications compliance is the place to do this.

13. Data Loss Prevention: Within this chapter, coverage of PowerShell and DLPS, SITS, Fingerprints and more is done with a focus on the real world.

14, Device Management: Exchange mailbox users typically connect to their mailboxes with Outlook desktop, OWA, and Mobile Devices. We cover PowerShell and mobile device management solely within the Exchange Online PowerShell module / world in this chapter.

15. Information Barriers: These are also known as logical barriers and control communications between groups of features. The new feature is the v2 version, which is covered now as well.

16. Insider Risk Management: Covers a feature geared to protecting resources from internal users. Dig deep into how to configure and use it practically in your tenant.

17. Labels: Categorizing documents, protecting documents is the purpose of labels and we cover this and how PowerShell can be used together with the Purview portal.

18. Privacy Management: Still new to Purview, Privacy Management relates to personal data that may be present in a tenant. PowerShell is available to maintain this depature.

19. Building Scripts: Now that we've covered the basics, this chapter is dedicated to building your own scripts for usage in management of Purview/Defender for Office. Truly focused on real-world examples and getting the most out of the power of PowerShell.

20. Reporting: PowerShell is great at gathering data and outputting large sets for consumption by management and administrators alike. In this chapter, we cover how we can use PowerShell to create relevant reports with PowerShell.

21. Troubleshooting: Things break. We get red in PowerShell. Sometimes we get yellow. What does it all mean? In our Troubleshooting chapter we cover how to troubleshoot issues that you may experience when using PowerShell in Exchange Online. Expert tips and techniques are covered.

A. Best Practices: PowerShell has some hard and fast rules that we must observe; however, sometimes, we near guard rails to guide us to better results. Best Practices focuses on generally agreed-upon methodologies and techniques for PowerShell scripting.

B. Miscellaneous: Some topics just don't fit in the rest of the book, and miscellaneous or menagerie are good terms for this chapter. Some are dedicated to PowerShell-specific concepts, while others are focused on Exchange PowerShell scenarios.

C. Secure Score: No real PowerShell is available for this feature, but we still cover its importance in informing administrators about their Microsoft 365 security stance.


Simply put, with over 540 pages written and maintained by experts, this book is of great value to IT Professionals. Any sort of training or consultants who would instead do the work for you would cover many times the cost of this book.

Note: Exchange Online PowerShell is purchased as a subscription service. 

About the Author

Damian Scoles
Damian Scoles

Damian Scoles has been a Microsoft MVP for the past eight years, specifically for Office Apps and Services and now Cloud and Datacenter Management. He is currently based out of the Chicago area and started out managing Exchange 5.5 and Windows NT. He has worked with Office 365 since BPOS and has experience with Azure AD, the Security and Compliance Center, and Exchange Online. Contributions to the community include helping on TechNet forums, creating PowerShell scripts that are located in the TechNet Gallery, writing detailed PowerShell / Office365 / Exchange blog articles (, tweets ( and creating PowerShell videos on YouTube (

Table of Contents



Chapter 1 PowerShell Basics

Chapter 2 Beyond the Basics

Chapter 3 Connecting With PowerShell

Chapter 4 Identity Management

Chapter 5 Security

Chapter 6 Data Loss Prevention

Chapter 7 Compliance

Chapter 8 Supervision

Chapter 9 Alerting

Chapter 10 Information Barriers

chapter 11 Threats & Mail Flow

Chapter 12 Device Management

Chapter 13 Labels and File Plans

Chapter 14 Building Scripts

Appendix A Best Practices

Appendix B Miscellaneous

Appendix C Microsoft Secure Score

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub