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

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 NameA 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.

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.





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