Quickly create A LOT of SQL Instances

Recently I delivered a demo on Policy Based Management for a customer.   To show this off well, I really wanted to have a larger number of SQL servers to show how PBM can be used to manage SQL Server sprawl.  I can only fit a few VMs in my laptop and Azure would burn though my $150 MSDN credit too quickly, so I decided to look for other options.    I then remembered that SQL Server supports up to 50 instances on the same machine.   

I’m too lazy to click Next  > Next > Next that many times, so I made a script to automatically install 50 instances of SQL on the same machine.

!!WARNING!!! -   This will blow up the size of your SQL install directory significantly!  (about 1GB per instance with SQL 2016).   Do not run this on production servers or any server that you even remotely care about!

If you are ok with this warning, you can get a copy of the script here.

  1. Save file as a .cmd
  2. Edit the values for ADMIN_ACCOUNT1 & 2 with your windows accounts
  3. Make sure your SQL 2016 DVD is mounted to D:
  4. Run

Additional Notes

  1. I tested this with SQL 2016, but older versions should work too.
  2. For my install, I canceled after about 20 instances since my C: drive was getting too big.    You can cancel the CMD if you feel you have enough instances, but let the final install complete normally.
  3. The script installs instances with Manual start mode. You can then use these cmd files to start and stop the services
  4. If you want your instances to autostart, adjust /SQLSVCSTARTUPTYPE=Automatic in the script before running it.