2 Installing dbatools

 

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:

  • Set-ExecutionPolicy
  • Set-PSRepository

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.

2.1 Minimum requirements

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.

2.1.1 Server

2.1.2 Workstation

2.1.3 Ports

2.1.4 Execution policy

2.2 Signed software

2.3 Understanding installation paths

2.4 Installation methods

2.4.1 The PowerShell Gallery

2.4.2 Trusting the PowerShell Gallery

2.4.3 Installing dbatools using the PowerShell Gallery, all users

2.4.4 PowerShell Gallery, local user

sitemap