Skip to content

Dbatools

main site : https://dbatools.io/getting-started/

Think of dbatools as a command-line SQL Server Management Studio.
In itself it is no more convenient then using SSMS.
The real power is using it for automation , and building complex tasks from simple commands.

install

Powershell (as Admin)

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Install-PackageProvider -Name NuGet
Install-Module -Name DBATools
# check  (this does not use dbatools commands) ok if several dbatools commands are listed
Get-Command -Name *login*

config

issue installing

Install-Module -Name DBATools

gives error :

NuGet provider is required to continue
PowerShellGet requires NuGet provider version ‘2.8.5.201’ or newer to interact with NuGet-bas
provider must be available in ‘C:\Program Files\PackageManagement\ProviderAssemblies’ or
‘C:\Users\Administrator\AppData\Local\PackageManagement\ProviderAssemblies’.
You can also run ‘Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force’.
Do you want and import the NuGet provider now?
[Y] Yes [N] No [S] Suspend [?] Help (default is “Y”): y

Y :

WARNING: Unable to download from URI ‘https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409’

Some posts say this is due to TLS 1.2 requirement
After running this command the security protocol shows as TLS12, but still same issue
firewall doesn’t allow SSL / TLS on the port that the install is trying to access ?
As a workaround : download the packager to another host and use sneaker-ware to copy it to the affected server

Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
idem error

How to install the Nuget provider for PowerShell on a unconnected machine
so I can install a nuget package from the PS command line?
(https://stackoverflow.com/questions/51406685/powershell-how-do-i-install-the-nuget-provider-for-powershell-on-a-unconnected)
! but his works =>

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Install-PackageProvider -Name NuGet