Change all MSSQL Database Recovery model to FULL using PowerShell

Changing the individual database recovery model is very simple with the Microsoft SSMS. But recently in one of our Nimesa customer environments, he had 200 databases in a non-production instance and all the databases are in the simple recovery model.

That user wanted to do POC of Nimesa Application-aware backup and Point in time recovery for MS SQL database server, Log backups are not possible with the simple recovery model, so I executed a small PowerShell script which changes all the databases to the FULL recovery model from the simple recovery model


Get-SqlDatabase -ServerInstance NW1\CLUST2

The above Powershell command gets all the databses on the Server instance

Then with a foreach loop, executed below query to change the database to the FULL recovery model

 ALTER DATABASE [$dbName] SET RECOVERY FULL WITH NO_WAIT 

Full script

Leave a Reply

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

Discover more from

Subscribe now to keep reading and get access to the full archive.

Continue reading