Downloads of v 1.1.18:


Last Update:

15 Sep 2021

Package Maintainer(s):

Software Author(s):

  • Chrissy LeMaire


admin powershell module template dba sqlserver sql tools database

dbatools (PowerShell Module)

This is not the latest version of dbatools (PowerShell Module) available.

  • 1
  • 2
  • 3

1.1.18 | Updated: 15 Sep 2021



Downloads of v 1.1.18:



Software Author(s):

  • Chrissy LeMaire

  • 1
  • 2
  • 3
dbatools (PowerShell Module) 1.1.18

This is not the latest version of dbatools (PowerShell Module) available.

  • 1
  • 2
  • 3

Some Checks Have Failed or Are Not Yet Complete

Not All Tests Have Passed

Validation Testing Passed

Verification Testing Passed


Scan Testing Resulted in Flagged as a Note:

At least one file within this package has greater than 0 detections, but less than 5

Learn More

Deployment Method: Individual Install, Upgrade, & Uninstall

To install dbatools (PowerShell Module), run the following command from the command line or from PowerShell:


To upgrade dbatools (PowerShell Module), run the following command from the command line or from PowerShell:


To uninstall dbatools (PowerShell Module), run the following command from the command line or from PowerShell:


Deployment Method:

📝 NOTE: This applies to both open source and commercial editions of Chocolatey.

1. Enter Your Internal Repository Url

(this should look similar to

2. Setup Your Environment

1. Ensure you are set for organizational deployment

Please see the organizational deployment guide

2. Get the package into your environment

  • Open Source or Commercial:
    • Proxy Repository - Create a proxy nuget repository on Nexus, Artifactory Pro, or a proxy Chocolatey repository on ProGet. Point your upstream to Packages cache on first access automatically. Make sure your choco clients are using your proxy repository as a source and NOT the default community repository. See source command for more information.
    • You can also just download the package and push it to a repository Download

3. Copy Your Script

choco upgrade dbatools -y --source="'INTERNAL REPO URL'" --version="'1.1.18'" [other options]

See options you can pass to upgrade.

See best practices for scripting.

Add this to a PowerShell script or use a Batch script with tools and in places where you are calling directly to Chocolatey. If you are integrating, keep in mind enhanced exit codes.

If you do use a PowerShell script, use the following to ensure bad exit codes are shown as failures:

choco upgrade dbatools -y --source="'INTERNAL REPO URL'" --version="'1.1.18'" 

Write-Verbose "Exit code was $exitCode"
$validExitCodes = @(0, 1605, 1614, 1641, 3010)
if ($validExitCodes -contains $exitCode) {
  Exit 0

Exit $exitCode

- name: Install dbatools
    name: dbatools
    version: '1.1.18'
    state: present

See docs at

chocolatey_package 'dbatools' do
  action    :install
  source   'INTERNAL REPO URL'
  version  '1.1.18'

See docs at

cChocoPackageInstaller dbatools
    Name     = "dbatools"
    Version  = "1.1.18"
    Source   = "INTERNAL REPO URL"

Requires cChoco DSC Resource. See docs at

package { 'dbatools':
  ensure   => '1.1.18',
  provider => 'chocolatey',
  source   => 'INTERNAL REPO URL',

Requires Puppet Chocolatey Provider module. See docs at

4. If applicable - Chocolatey configuration/installation

See infrastructure management matrix for Chocolatey configuration elements and examples.

This package was approved as a trusted package on 15 Sep 2021.


dbatools is sort of like a command-line SQL Server Management Studio. The project initially started out as Start-SqlMigration.ps1, but has now grown into a collection of over 300 commands that help automate SQL Server tasks and encourage best practices.

NOTE: This module requires a minimum of PowerShell v3.

NOTE: This is an automatically updated package. If you find it is out of date by more than a week, please contact the maintainer(s) and let them know the package is no longer updating correctly.

$ErrorActionPreference = 'Stop'

$moduleName = 'dbatools'      # this could be different from package name

$module = Get-Module -Name $moduleName
if ($module) {
    Write-Verbose "Module '$moduleName' is imported into the session. Removing it."
    Remove-Module -Name $moduleName -Force -ErrorAction SilentlyContinue

    if ($lib = [appdomain]::CurrentDomain.GetAssemblies() | Where-Object FullName -like "dbatools, *") {
        Write-Verbose "Found locked DLL files for module '$moduleName'."
        $moduleDir = Split-Path $module.Path -Parent
        if ($lib.Location -like "$moduleDir\*") {
            Write-Warning @"
We have detected dbatools to be already imported from '$moduleDir' and the dll files have been locked and cannot be updated.
Please close all consoles that have dbatools imported (Remove-Module dbatools is NOT enough).
$ErrorActionPreference = 'Stop'

$toolsDir   = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
$moduleName = 'dbatools'  # this may be different from the package name and different case

if ($PSVersionTable.PSVersion.Major -lt 3) {
    throw "$moduleName) module requires a minimum of PowerShell v3."

# module may already be installed outside of Chocolatey
Remove-Module -Name $moduleName -Force -ErrorAction SilentlyContinue

$sourcePath = Join-Path -Path $toolsDir -ChildPath "$"
$destPath   = Join-Path -Path $env:ProgramFiles -ChildPath "WindowsPowerShell\Modules\$moduleName"

if ($PSVersionTable.PSVersion.Major -ge 5)
    $destPath     = Join-Path -Path $destPath -ChildPath $env:ChocolateyPackageVersion

Write-Verbose "Creating destination directory '$destPath' for module."
New-Item -Path $destPath -ItemType Directory -Force -ErrorAction SilentlyContinue | Out-Null

Write-Verbose "Extracting '$moduleName' files from '$sourcePath' to '$destPath'."
Get-ChocolateyUnzip -FileFullPath $sourcePath -Destination $destPath

if ($PSVersionTable.PSVersion.Major -lt 4)
    $modulePaths = [Environment]::GetEnvironmentVariable('PSModulePath', 'Machine') -split ';'
    if ($modulePaths -notcontains $destPath)
        Write-Verbose "Adding '$destPath' to PSModulePath."
        $newModulePath = @($destPath, $modulePaths) -join ';'

        [Environment]::SetEnvironmentVariable('PSModulePath', $newModulePath, 'Machine')
        $env:PSModulePath = $newModulePath
$ErrorActionPreference = 'Stop'

$moduleName = 'dbatools'
$sourcePath = Join-Path -Path $env:ProgramFiles -ChildPath "WindowsPowerShell\Modules\$moduleName"

Write-Verbose "Removing all version of '$moduleName' from '$sourcePath'."
Remove-Item -Path $sourcePath -Recurse -Force -ErrorAction SilentlyContinue

if ($PSVersionTable.PSVersion.Major -lt 4) {
    $modulePaths = [Environment]::GetEnvironmentVariable('PSModulePath', 'Machine') -split ';'

    Write-Verbose "Removing '$sourcePath' from PSModulePath."
    $newModulePath = $modulePaths | Where-Object { $_ -ne $sourcePath }

    [Environment]::SetEnvironmentVariable('PSModulePath', $newModulePath, 'Machine')
    $env:PSModulePath = $newModulePath
md5: 936C9185C71F68260C086C7F8BF20253 | sha1: F154E46A288331B1603453C1C9CF464429269110 | sha256: 7510C7ADF355D74980D78671F9F144E94E89F75AB4A826F419EEF0B6DF164606 | sha512: 92205466E03250A50F41CF62EA6A5C2D079EA1B08C63E691751711C34DEF8A2DF0822B5F2B6F5351F3B3BCF836BDBA96EAA670119A0E13932D1E01E555E162F9

Log in or click on link to see number of positives.

In cases where actual malware is found, the packages are subject to removal. Software sometimes has false positives. Moderators do not necessarily validate the safety of the underlying software, only that a package retrieves software from the official distribution point and/or validate embedded software against official distribution point (where distribution rights allow redistribution).

Chocolatey Pro provides runtime protection from possible malware.

Add to Builder Version Downloads Last Updated Status
dbatools (PowerShell Module) 1.1.124 133 Tuesday, August 16, 2022 Approved
dbatools (PowerShell Module) 1.1.122 421 Saturday, August 6, 2022 Approved
dbatools (PowerShell Module) 1.1.121 199 Thursday, August 4, 2022 Approved
dbatools (PowerShell Module) 1.1.120 252 Monday, August 1, 2022 Approved
dbatools (PowerShell Module) 1.1.119 199 Saturday, July 30, 2022 Approved
dbatools (PowerShell Module) 1.1.118 351 Monday, July 25, 2022 Approved
dbatools (PowerShell Module) 1.1.117 230 Thursday, July 21, 2022 Approved
dbatools (PowerShell Module) 1.1.116 96 Thursday, July 21, 2022 Approved
dbatools (PowerShell Module) 1.1.115 95 Thursday, July 21, 2022 Approved

This package has no dependencies.

Discussion for the dbatools (PowerShell Module) Package

Ground Rules:

  • This discussion is only about dbatools (PowerShell Module) and the dbatools (PowerShell Module) package. If you have feedback for Chocolatey, please contact the Google Group.
  • This discussion will carry over multiple versions. If you have a comment about a particular version, please note that in your comments.
  • The maintainers of this Chocolatey Package will be notified about new comments that are posted to this Disqus thread, however, it is NOT a guarantee that you will get a response. If you do not hear back from the maintainers after posting a message below, please follow up by using the link on the left side of this page or follow this link to contact maintainers. If you still hear nothing back, please follow the package triage process.
  • Tell us what you love about the package or dbatools (PowerShell Module), or tell us what needs improvement.
  • Share your experiences with the package, or extra configuration or gotchas that you've found.
  • If you use a url, the comment will be flagged for moderation until you've been whitelisted. Disqus moderated comments are approved on a weekly schedule if not sooner. It could take between 1-5 days for your comment to show up.
comments powered by Disqus