preface

I am very passionate about using PowerShell to automate the administration of Windows systems. This will become apparent very quickly if you talk to me, listen to me at conferences, or read my other books or blogs. WMI has a reputation for being powerful but hard to use. PowerShell is the way forward for system administrators, and WMI is that horrible, old technology that no one really knows how to use. So why do we need a book on PowerShell and WMI?

In reality, PowerShell and WMI are made for each other. They are both powerful, but put them together and you have low-level access to just about every facet of your Windows system. WMI is a first-class citizen in the PowerShell world, with a set of cmdlets to make using WMI easier and to provide the ability to work over WSMAN or DCOM protocols. The great strength of the pairing of PowerShell and WMI is that you can work with both local and remote systems. The other point to remember is that Microsoft is putting a lot of effort into WMI for the Windows 8 family of products. There are big changes coming regarding what you can do with WMI and how you can use it.

In short, it seemed that now was the time to bring WMI in from the cold and into mainstream administration where it belongs.

This book is written for system administrators, and it provides a suite of scripts to automate a large range of administration tasks. In most cases, these scripts are ready to use in your environment—I use many of them on a regular basis. In the chapters, those scripts are explained and the background to the tasks is discussed so you can put the script into context for your environment. This isn’t a cookbook or a theoretical book on the PowerShell language—it’s more. It’s a practical guide to taking these two technologies and making them do what you need in order to solve the problems you have in your environment.

Best practices can be an emotive subject, but one of my goals in writing the book has been to supply best practice guidelines for using PowerShell and WMI and Windows administration in general. There is no point in automating bad practice—it just makes mistakes happen quicker.

The solutions presented in the book show the way that I solve various problems. Use the scripts to solve your problems, and if you find better solutions, please share them with the PowerShell community.

I’ve gained a number of things during the writing of this book:

I hope you get a sense of that passion and interest from reading this book, and I hope that it both helps you in your role as an administrator and inspires you to investigate some of the areas of PowerShell and WMI that I haven’t been able to cover. Who knows, we could be talking about it at a PowerShell Deep Dive sometime soon.

Use the techniques, join the PowerShell community, and most of all, enjoy what you do.