Master PowerShell Tricks Volume 1
Minimum price
Suggested price

Master PowerShell Tricks Volume 1

About the Book

There are many cool things about Windows PowerShell. For me three of the most awesome things are the following:

1. If you don’t like the way Windows PowerShell does things, you can change it.

2. If Windows PowerShell can’t do something you need, you can add it.

3. The Windows PowerShell community is super dedicated, and will help you do both one and two. 

Now, to be honest at times, it is necessary to write hundreds and hundreds of lines of arcane code, to dive into the deepest and darkest mysteries of programing, and even to learn about things like API’s, Constructors, Events, threading, ACL’s, DACL’s, CACL’s and maybe even Tetradactylies. Then again, most of the time it is not. In fact, it has been years and years since I wrote a hundreds and hundreds of lines of arcane code. 

It is almost as if the Windows PowerShell team deliberately tried to make Windows PowerShell easy to use and easy to learn. Hmm … I wonder if that approach would ever catch on? Anyway, there used to be an old saw: “Ease of use is directly opposed to program capability.” Or, in other words, if it is easy to use, it probably is not all that powerful. Well, PowerShell changes that … dramatically. 

And yet, Windows PowerShell is also deceptively easy to use. One can go from Get-Service and Get-Process or even Get-Date to some pretty complicated stuff in like one line of code. 

This is why item number three is so important. The authors of this book: Dave, Sean, Thomas and Allan are all Windows PowerShell experts, and have even been recognized by Microsoft as community leaders. So, this means not only do they know their stuff, but they are also great at sharing that knowledge with the community. Sean Kearney is even an Honorary Scripting Guy – a very elite group indeed!

One of the great way that MVP’s share their knowledge and experience is via MVP Days a traveling road show that was started by Dave and Cristal Kawula. This is a very well run event, and I have had the opportunity to speak at two of the events … it is cool, and it is fun.

So grab this book, get it autographed, and learn how to master some awesome PowerShell tricks. It is cool. 


Ed Wilson

Microsoft Scripting Guy


About the Authors

Dave Kawula
Dave Kawula

Dave is a Microsoft Most Valuable Professional (MVP) with over 20 years of experience in the IT industry. His background includes data communications networks within multi-server environments, and he has led architecture teams for virtualization, System Center, Exchange, Active Directory, and Internet gateways. Very active within the Microsoft technical and consulting teams, Dave has provided deep-dive technical knowledge and subject matter expertise on various System Center and operating system topics.

Dave is well-known in the community as an evangelist for Microsoft, 1E, and Veeam technologies. Locating Dave is easy as he speaks at several conferences and sessions each year, including TechEd, Ignite, MVP Days Community Roadshow, and VeeamOn. 

Recently Dave has been honored to take on the role of Conference Co-Chair of TechMentor with fellow MVP Sami Laiho.  The lineup of speakers and attendees that have been to this conference over the past 20 years is really amazing. Come down to Redmond or Orlando in 2018 and you can meet him in person.

As the founder and Managing Principal Consultant at TriCon Elite Consulting, Dave is a leading technology expert for both local customers and large international enterprises, providing optimal guidance and methodologies to achieve and maintain an efficient infrastructure.


Twitter: @DaveKawula

Thomas Rayner
Thomas Rayner

Thomas Rayner is a Microsoft Most Valuable Professional (MVP) and Honorary Scripting Guy with many years of experience in IT. He is a master technologist, specializing in DevOps, systems and process automation, public, private and hybrid cloud, and PowerShell. Thomas is an international speaker, best-selling author, and instructor covering a vast array of IT topics.

Allan Rafuse
Allan Rafuse

Allan is a Microsoft Most Valuable Professional (MVP) and a Veeam Vanguard. Throughout his career, his skills have allowed him to work in variety of different industries (Oil and Gas, Banking and Healthcare) and also move to several Canadian provinces and even live in Europe. He has worked in many job roles that support the data center stack and cloud components and is also well versed in designing and deploying robust, highly available enterprise solutions in single or multi datacenter environments.

Integrating products and automation are passions of Allan. His solutions usually employ virtual environments (Hyper-V, VMware), Active Directory, SQL Server, System Center (SCCM, SCOM, SCVMM, SCORCH), Windows Server, Exchange, PowerShell, Veeam products and even Linux. He is an expert at scripting solutions and has an uncanny ability to reduce complexity and maximize the functionality of PowerShell.

Allan is a huge tech evangelist and the founder and Managing Principal Consultant at BroadArc Consulting. His consulting skills, vision, methodologies and frameworks have allowed many projects and solutions to thrive and succeed.

If you haven’t had the chance to personally meet Allan’s at an IT community speaking, you can always virtually follow him and introduce yourself on his blog or twitter.

BLOG: | Twitter: @AllanRafuse | LinkedIn:

Bundles that include this book

Bought separately
Bundle Price

Table of Contents

Foreword Ed Wilson “The Scripting Guy” iii

Acknowledgements v

From Dave v

About the Authors vi

Dave Kawula - MVP vi

Sean Kearney - MVP vii

Thomas Rayner - MVP vii

Allan Rafuse – MVP vii

Ed Wilson – The Scripting Guy viii

Technical Editors ix

Cristal Kawula – MVP ix

Emile Cabot - MVP ix

Contents xi

Introduction 1

North American MVPDays Community Roadshow 1

Structure of the Book 1

Sample Files 2

Additional Resources 3

Chapter 1 5

Simulating a Ransomware Attack with PowerShell 5

But how does one test for Ransomware detection? 5

The Code 6

Chapter 2 8

Retrieving the Distribution Lists a User is a Member Of 8

The Code 9

Chapter 3 10

Identifying Large Exchange Mailbox Folders via PowerShell 10

The Code 11

Chapter 4 14

Deploying a Domain Joined Nano Server via PowerShell 14

PowerShell Cmdlets for the Network Stack 15

Chapter 5 19

Enabling Auto Notification of Specific File Changes 19

The Code 19

Chapter 6 21

Copying the Output of the last PowerShell command to the clipboard 21

The Code 21

Chapter 7 23

Validate the Length of An Integer 23

The Code 23

Chapter 8 24

Allow a Null Value for An Object That Doesn’t Normally Allow it 24

Chapter 9 25

Getting Started with Pester 25

Chapter 10 29

Find missing Subnets in AD Sites and Services 29

Cloud Environments 29

Solution 29

Things to thing about 30

The Code 30

Chapter 11 32

Copy Directories/Files to a list of Remote Computers 32

Here-Strings to the Rescue 33

Chapter 12 36

Making the Configuration Manager PowerShell Module Discoverable 36

The Code 37

Chapter 13 39

Resolving issues with slow Outbound mail in Office 365 in a Hybrid connection using a SmartHost or Internal Appliance 39

Chapter 14 43

Use PowerShell to Work with Data from OMS 43

Parsing MS OMS data with PowerShell 43

Importing the CSV file using PowerShell 44

Chapter 15 50

Use PowerShell to Explore Office 365 Installation 50

Chapter 16 53

PowerShell 5 Classes: Constructor Overloading 53

What’s an overload anyway? 53

Creating overloaded constructors 55

Chapter 17 58

Filtering Event Logs with PowerShell 58

Seven parameter sets 58

Chapter 18 64

Use the PowerShell 5 Convert-String Cmdlet 64

Convert-String 64

The old flipty dipty 64

Expanding the string idea 65

Chapter 19 67

Use PowerShell to Detect if a Location is a Directory or a Symlink 67

Chapter 20 68

Bypassing PowerShell Execution Policy 68

Chapter 20 70

Starting up and Shutting down a list of VM’s in a specific order 70

Chapter 21 72

Join us at MVPDays and meet great MVP’s like this in person 72

Live Presentations 72

Video Training 72

Live Instructor-led Classes 72

Consulting Services 73

Twitter 74

Other books by these authors

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