Master PowerShell Tricks Volume 3
Minimum price
Suggested price

Master PowerShell Tricks Volume 3

About the Book

“PowerShell is awesome.” I’ve lost track of how many times I’ve heard this phrase and I never get tired of hearing it..


I remember the launch of Windows Server 2012 like it was yesterday. It was a major release with innovation across the board in Hyper-V, Storage, Networking, Scale and Performance. Underlying all of this innovation was one unifying investment designed to make it easier for you to harness these technologies: PowerShell. With over 2500 PowerShell commandlets built-in, rich automation was now in everyone’s hands. Over the years, we listened as you used PowerShell for everything from simple repeatable tasks to complex deployments of servers, software and services where PowerShell removed human error.


A few releases later, we’ve added over a thousand new commandlets, Desired State Configuration (DSC), and Just Enough Administration (JEA) making PowerShell an indispensable and valuable skill for every résumé. If you haven’t learned PowerShell yet, there’s no time like the present. (Spoiler alert: It’s fun too…) The authors are PowerShell experts and MVPs who teach and coach in the Microsoft community with years of experience. In addition, they have used their learnings in the community to provide feedback to the PowerShell team and help influence the product direction. Whether you or a seasoned user or a PowerShell newbie, you can’t ever know too many PowerShell Tricks.


Jeff Woolsey

Windows Server/Hybrid Cloud


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 by: Jeff Woolsey iii

Acknowledgements iv

From Dave iv

About the Authors v

Dave Kawula - MVP v

Thomas Rayner - MVP vi

Allan Rafuse – MVP vii

Will Anderson – MVP viii

Mick Pletcher – MVP ix

Technical Editors x

Cristal Kawula – MVP x

Emile Cabot - MVP xi

Cary Sun – CCIE #4531 (Future Microsoft MVP) xii

Contents xiii

Introduction 20

North American MVPDays Community Roadshow 20

Sample Files 21

Additional Resources 21

Chapter 1 23

Using PowerShell to Download Drivers via FTP 23

Chapter 2 27

Using PowerShell to Download Videos from Channel 9 27

Chapter 3 35

Snapshot Management of VMware with PowerShell 35

Snapshot Management 35

Password Issues 36

Report Output 36

The Code (VMWare Example) 37

Chapter 4 42

Setting SQL Server Memory Allocation (Maximum and Minimum) 42

Retrieving the Physical Memory 42

Determine SQL Server Maximum Memory 43

Reconfigure SQL Server Memory Allocation 44

Making IT Work 46

Chapter 5 47

Using PowerShell to Add a Direct Member to an SCCM Collection 47

Chapter 6 49

Using PowerShell to Manage the Datadog Cloud Service 49

Authentication 50

Example Snippets 50

Searching for Events 53

Chapter 7 55

Using PowerShell to Update the .Default and All User Profiles Registry 55

Enumerate all the existing user profiles 55

Add the .DEFAULT user profile to the list of existing profiles 56

Iterate through all the profiles 56

Manipulate the users’ registry 57

If the Profile hive was loaded by script, unload it 58

Chapter 8 60

Working with PowerShell Active Directory Module as a Non-Privileged User 60

Chapter 9 62

Using PowerShell to Split a String Without Losing the Character You Split On 62

Chapter 10 65

What's the difference between -split and .split() in PowerShell? 65

Chapter 11 68

PowerShell Rules for Format-Table and Format-List 68

Chapter 12 70

The Difference Between Get-Member and .GetType() in PowerShell 70

Chapter 13 73

Dynamically Create Preset Tests for PowerShell 73

Chapter 14 77

Piping PowerShell Output into Bash 77

Chapter 15 78

How to List All the Shares on a Server using PowerShell 78

Chapter 16 81

Get a ServiceNow User Using PowerShell 81

Chapter 17 83

Add a Work Note to a ServiceNow Incident with PowerShell 83

Chapter 18 86

Use PowerShell to see how many items are in a Directory 86

Chapter 19 87

Add a Column to a CSV using PowerShell 87

Chapter 20 90

Diagnosing slow PowerShell Load Times 90

Chapter 21 91

Use Test-NetConnection in PowerShell to see if a Port is Open 91

Chapter 22 92

Use PowerShell to find out How Long it is until Christmas 92

Chapter 23 94

Use PowerShell to Figure out “What day of the week” x number of days from now 94

Chapter 24 96

Using Get-Member to Explore Objects 96

Chapter 25 99

Using Select-Object to Explore Objects 99

Chapter 26 104

Can PowerShell Parameters Belong to Multiple Sets? 104

Chapter 27 106

Opening an Exchange Online Protection Shell 106

Chapter 28 108

Import Active Directory Module into Windows PE 108

Chapter 29 120

Using PowerShell to report on Windows Updates installed during MDT OSD Build 120

Chapter 30 130

Report on Mapped Drives to understand Cryptolocker Vulnerabilities with SCCM and PowerShell 130

Chapter 31 141

Set Windows Features and Verify with PowerShell 141

Chapter 32 148

Uninstall an Application by Name with PowerShell 148

Chapter 33 151

Azure Automatic Account Creation and Adding Modules using PowerShell 151

Creating the Azure Automation Account 151

Creating a Blob Container in AzureRM 153

Upload a Blob Container 155

Chapter 34 157

Configuring Azure Automation Runbooks and Understanding Webhook Data using PowerShell 157

Creating the Runbook Script 158

Publish the Runbook 160

Create an Alert 161

Validating our Data 165

Chapter 35 169

Utilizing Webhook Data in Functions and Validate Results using PowerShell 169

Building on Webhook Data 169

Chapter 36 180

Adding Configuration to your Azure Automation Account using Azure DSC 180

Push vs. Pull 181

Pros and Cons to Each 182

Things to Consider 183

Upload the Configuration 186

Compile the Configuration 189

Chapter 37 194

Onboarding Automation DSC Endpoints and Reporting 194

Register the Virtual Machine 195

Apply a Configuration 197

Azure Automation DSC Reports 199

Connecting to Log Analytics 201

Chapter 38 206

Publishing Configurations and Pushing them with Azure DSC 206

Publish the Configuration 206

Install the VM Extensions 208

Chapter 39 212

Testing RDMA Connectivity with PowerShell 212

Chapter 40 223

Storage Spaces Direct Network Reporting HTML Script for Mellanox Adapters via PowerShell 223

Chapter 41 227

Using PowerShell and DSC to build out an RDSH Farm from Scratch 227

Chapter 42 248

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

Live Presentations 248

Video Training 248

Live Instructor-led Classes 249

Consulting Services 249

Twitter 250

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