SQL Server Management Studio must be installed. You can get by with just SMO but really, we take advantage of many of the libraries provided by SQL Server Management Studio.
We subscribe to idea that developers should release early and release often. dbatools has been around since 2014 but is still in prerelease (0.8.x). It’s been tested by hundreds if not thousands of people and each release gets better and better because of your early suggestions, bug reports and feedback.
We plan for version 1.0 to be gorgeous and standardized. This means means that we’ll be introducing breaking changes by fixing our bad habits (inconsistent parameter names, etc). We’re aiming for 1.0 to be released around July 2017 but we just wanted to let you know now.
Method 1: Install dbatools from the PowerShell Gallery
Install-Module requires Run As Administrator, and installs dbatools globally. Don’t have admin access or want to install dbatools only for yourself?
Install-Module dbatools -Scope CurrentUser
Don’t have Windows 10 and need help with PowerShell Gallery? Here’s a getting started guide.
Method 2: Scripted installer directly from GitHub
Invoke-Expression (Invoke-WebRequest -UseBasicParsing https://dbatools.io/in)
This will install dbatools locally (for just the current user) to the Documents\WindowsPowerShell\Modules folder.
Method 3: Download the zip directly and manually import the module.
Invoke-WebRequest https://dbatools.io/zip -Outfile dbatools.zip
Expand-Archive dbatools.zip -DestinationPath .
Method 4: Clone the repository from GitHub
git clone https://github.com/sqlcollaborative/dbatools
Installing the module will make a number of commands available to you.
Voila! Now you can migrate SQL Server instances with a single command.
Start-SqlMigration -Source sql01 -Destination sql02 -DetachAttach
Or you can choose your own adventure and migrate just a few things at once.
Copy-Database -Source sql01 -Destination sql02 -Databases Northwind, pubs -BackupRestore -NetworkPath \\server\share\sql\migrations
Copy-SqlLinkedServer -Source sql01 -Destination sql02
Copy-SqlLogin -Source sql01 -Destination sql02 -Logins realcajun,netnerds,’BASE\ctrlb’
Like what you see? Please rate this module on Microsoft Script Center!