I refresh my test SQL Servers at least monthly with a fresh VM. Setting up directories, installing SQL Server, setting up security, and restoring databases all take time. And I want it to be flexible enough where I can switch out files as they are updated, such as was the case with SQL Server 2025.
I know others are looking to do it and I wanted to put out how you could set up such automation with a minimum of PowerShell, T-SQL, and command line scripts. So I wrote an article talking about how to set this all up. There are definitely more elegant ways. There are some tools out there that can streamline this a lot, some of which are free (dbatools). But if you are just looking at how to get started: