4 A gentle introduction to dbatools commands

 

Now you should be all set up and ready to start working with dbatools. In this chapter, you will learn about a few new commands and four of the common dbatools parameters: -SqlInstance, -SqlCredential, -ComputerName, and -Credential.

These parameters are particularly useful because they’re used in nearly every command to connect to both local and remote servers. The primary goal of this chapter is to get you comfortable with these common parameters. You will see them used throughout this book and in all of the dbatools that you will write in the future. Having consistent parameters throughout the entire module was a high priority for the 1.0 release of dbatools.

4.1 Getting started

As DBAs, it is in our nature to be wary; we want to understand what a tool is going to do before we let it anywhere near our production environment. For this reason, we’ll start with commands that are read-only.

The first command that we have chosen to use is one that will help you check that you are able to connect to the SQL Server instances. We figure that this is a good place to start because if you can’t connect to the SQL Server instance, then you will not be able to use any of the dbatools commands.

4.2 Checking the SQL connection

 
 

4.3 First, getting help

 

4.4 Running your first dbatools command

 
 

4.5 The -SqlInstance parameter

 

4.5.1 Single instances

 
 
 

4.5.2 Multiple instances

 

4.6 The -SqlCredential parameter

 

4.6.1 Connecting to instances with SQL Server Authentication

 

4.6.2 Saving the credential to use SQL Server Authentication with multiple commands

 
 
 
 

4.6.3 Other methods of using credentials for SQL Server Authentication

 
 

4.6.4 Connecting to instances with a different Windows account

 
 
 

4.7 The ComputerName parameter

 
 
 
 

4.7.1 Methods of listing the SQL services on multiple servers

 
 

4.8 The -Credential parameter

 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage