In this chapter, we’ll cover minimum requirements, various installation methods, and gotchas. Understanding how to install dbatools will not only enable you to use our toolset, it will also enable you to install any other PowerShell module in the PowerShell Gallery.
The old saying, “Before you do anything, you have to do something first,” holds true for installing dbatools and other PowerShell modules. Specifically, you may have to execute the following two commands first:
If you have not yet modified your default execution policy, or trusted Microsoft’s PowerShell Gallery using Set-PSRepository, we’ll help guide you through these steps. If you are already familiar with the PowerShell Gallery and installing dbatools, feel free to skip to the next chapter.
We’re going to start with minimum requirements because not everyone can be on the latest and greatest setup at work. It’s useful to know whether the old workstation we inherited can support dbatools. The good news is that the answer is most likely yes!
dbatools originally started as a migration module, so it was created with requirements that are as low as possible. This allows us to use dbatools in the older environments that are most in need of migrations. Because of PowerShell’s flexibility, dbatools also works in newer environments such as Azure, SQL Server on Linux, and PowerShell on macOS.