PowerShell Gallery dbatools – PowerShell Extension for Database Professionals

by May 29, 2018

In the previous tip we explained how you can get PowerShellGet up and running with your PowerShell version. Now let’s see how easily the PowerShell Gallery can extend the PowerShell functionality.

PowerShell is a general-purpose automation language, and database professionals from around the world have started to work on a PowerShell extension called “dbatools” that can be freely downloaded from the PowerShell gallery:

 
PS> Install-Module dbatools -Scope CurrentUser -Force
 

Once installed, PowerShell now has an extensive number of new and database-centric commands available for you:

 
PS> Get-Command -Module dbatools

CommandType     Name                                               Version    Sou
                                                                              rce
-----------     ----                                               -------    ---
Alias           Attach-DbaDatabase                                 0.9.332    dba
Alias           Backup-DbaDatabaseCertificate                      0.9.332    dba
Alias           Connect-DbaSqlServer                               0.9.332    dba
Alias           Copy-SqlAgentCategory                              0.9.332    dba
Alias           Copy-SqlAlert                                      0.9.332    dba
Alias           Copy-SqlAudit                                      0.9.332    dba
Alias           Copy-SqlAuditSpecification                         0.9.332    dba
Alias           Copy-SqlBackupDevice                               0.9.332    dba
Alias           Copy-SqlCentralManagementServer                    0.9.332    dba
Alias           Copy-SqlCredential                                 0.9.332    dba
Alias           Copy-SqlCustomError                                0.9.332    dba
Alias           Copy-SqlDatabase                                   0.9.332    dba
Alias           Copy-SqlDatabaseAssembly                           0.9.332    dba
Alias           Copy-SqlDatabaseMail                               0.9.332    dba
Alias           Copy-SqlDataCollector                              0.9.332    dba
Alias           Copy-SqlEndpoint                                   0.9.332    dba
Alias           Copy-SqlExtendedEvent                              0.9.332    dba
Alias           Copy-SqlJob                                        0.9.332    dba
Alias           Copy-SqlJobServer                                  0.9.332    dba
Alias           Copy-SqlLinkedServer                               0.9.332    dba
Alias           Copy-SqlLogin                                      0.9.332    dba
Alias           Copy-SqlOperator                                   0.9.332    dba
Alias           Copy-SqlPolicyManagement                           0.9.332    dba
Alias           Copy-SqlProxyAccount                               0.9.332    dba
Alias           Copy-SqlResourceGovernor                           0.9.332    dba
Alias           Copy-SqlServerAgent                                0.9.332    dba
Alias           Copy-SqlServerTrigger                              0.9.332    dba
Alias           Copy-SqlSharedSchedule                             0.9.332    dba
Alias           Copy-SqlSpConfigure                                0.9.332    dba
Alias           Copy-SqlSsisCatalog                                0.9.332    dba 
...
 

The module is well documented, so you can use Get-Help for each of these commands to discover details and view example code. Also, when you search for “PowerShell + dbatools” using your favorite search engine, you find a vibrant community with many examples and tutorials.

Twitter This Tip! ReTweet this Tip!