Chapter 2. Setting up your scripting environment

 

OK, it’s time to start actually doing stuff. We’ll begin by making sure you have a functioning scripting environment ready to go. We strongly recommend that you work through each step in this chapter, to make sure you have an environment in which you can follow along with us and where you can complete the hands-on exercises that appear at the end of many chapters.

2.1. The operating system

The first thing you’re going to need, of course, is a computer running an operating system. Although the techniques we cover in this book apply equally to Linux, macOS, and Windows, the examples we’re providing—because they use Windows’ Windows Management Instrumentation (WMI) and Common Information Model (CIM) systems—will only work on Windows. Therefore, we think it makes sense for you to have a Windows computer handy. And we recommend that you use Windows 10 or later, rather than an older client operating system or a server operating system. Acquiring and installing Windows 10 is outside the scope of this book, of course, but they should be familiar tasks to you (if they’re not, then you’re probably getting a bit ahead of yourself with this book). You probably can follow along with this book using Windows 7 Service Pack 1 or Windows 8.1, but we’re not going to guarantee that you won’t run into some weird problems, because we didn’t test on those older operating systems.

2.2. Windows PowerShell

2.3. Administrative privileges and execution policy

2.4. A script editor

2.5. Setting up a virtual environment

2.6. Example code

2.7. SQL Server Express

2.8. Your turn