chapter three

3 The dbatools lab

 

dbatools can help with a plethora of tasks and as you read through these chapters you’re going to get excited and want to run the commands for yourself. You know what they say, 'seeing is believing'! Please do not run straight to your production environments and test out your new found commands. The key to PowerShell is in its name: it’s power ful and we don’t want to do any damage while we learn and perfect our skills. Therefore, we need to set up an environment where we can run through all the examples and labs in this book without worrying about causing any harm along the way.

Setting up a lab will give you the freedom to practice retrieving information as well as testing some more complicated scenarios such as setting up log shipping, or migrating databases between SQL Server versions. In this chapter, we have two options for you, with option 1 we will cover how to install two instances of SQL Server Developer edition on Windows using dbatools. This will give us the perfect area to test all our dbatools commands as they are all supported on the Windows operating system.

For option 2, we’ll take a look at how we can use containers to create demo environments on our local machine fast. These can be really convenient, especially due to their ephemeral nature, meaning we can quickly destroy and recreate demo containers with ease.

3.1 Option 1: Windows Lab

3.1.1 Installation media for our lab

3.1.2 Building the lab

3.1.3 Configuration Scripts

3.1.4 Windows Lab is ready for action

3.2 Option 2: Quick demo environments using containers

3.2.1 Running SQL Server in a container

3.2.2 More containers please!

3.3 Hands-on Lab