PowerShell – How to Install dbatools?

dbatools installs as a PowerShell module on a Windows management machine. Rob Sewell, known as DBA with Beard, introduced me to it.

A reusable tool kit remains organized while one tool is inspected beside a sample joint.

That conversation happened at SQLPASS when I had little time to learn another scripting language. Using dbatools in customer work changed my view. Its reusable administration functions reduce the need to write every script from scratch. I still review each command’s effect.

# Run only when an online module installation is approved.
Install-Module -Name dbatools -Scope CurrentUser
Get-Module -Name dbatools -ListAvailable | Select-Object Name, Version, Path
Import-Module dbatools
Get-Command -Module dbatools | Select-Object -First 10 Name

A current-user installation normally doesn’t require an administrator shell. Installation downloads from PowerShell Gallery. Review the source and prompts under your organization’s policy. Don’t automatically change execution policy, trust every publisher or suppress certificate checks.

Original 2018 dbatools installation screenshot. Current prompts and module versions can differ.
Original 2018 dbatools installation screenshot. Current prompts and module versions can differ.

Inspect the installed version and discover commands before production work. Read help and test in a lab. Use preview support where the command provides it. The official guide also covers approved offline installation.

Reference: Official dbatools installation guide.

A reusable command is not a substitute for understanding its effect, it is automation to inspect and test.

Published by Pinal Dave on SQLAuthority. More of my work at pinaldave.com.


Discover more from SQL Authority with Pinal Dave

Subscribe to get the latest posts sent to your email.

DBA, PowerShell, SQL Server
Previous Post
Transaction Log Backups Based on Log Size
Next Post
PowerShell – Get Maximum Memory of Server with dbatools

Related Posts

1 Comment. Leave new

  • yeh, yeh … what if it says “InstallModule not recognised”, what if you need to install a newer version of powershell first? and what if that won’t install until you update Windows Management Framework? … etc etc

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.