Press "Enter" to skip to content

Moving SQL Server Database Files

Vlad Drumea makes a move:

This post demos a script I put together to help move SQL Server database files to another drive and folder by generating PowerShell and T-SQL commands.

I’ve decided to make this script for situations where installing the dbatools PowerShell module wouldn’t be possible.
Otherwise, I highly recommend using dbatools’ Move-DbaDbFile command.

Click through for the script, and I second Vlad’s recommendation of dbatools for this kind of effort.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.