Within the SQL Server community, simplified migrations sparked the adoption of not just dbatools but PowerShell as well. The videos showing the migration of all parts of a SQL Server instance containing a SharePoint installation to a new SQL Server instance such as https://youtu.be/hg8tovMRX2k resonated with DBAs.
However, as DBAs ourselves and with feedback from the community, we know that SQL Server migrations are often not as simple as the video shows. Doing a migration of large databases using the backup and restore method or even detach and attach will mean the business agreeing to a long downtime for the systems relying on those databases whilst all of the data is moved. SQL Server instances that have existed for a long time may have a large number of SQL Agent Jobs, Logins, Linked Servers or other objects that are no longer in use and migrating those also is unnecessary.
This chapter will not resolve all of these scenarios but will provide you with the knowledge to be able to plan, test and execute your complex migrations. Testing is important; we advise that, if you are able to, you perform thorough testing of these complex tasks before you implement them on your systems. Scripting these with dbatools enables you to keep the scripts so that you can repeat the same tasks on your production instances by changing the values for instances.