Skip to content

February 1, 2013


Set Database Recovery Model using Powershell

by Scott Newman

Another quick script to set all database recovery models using powershell.  This ignores system databases.  This uses sqlpsx as well.

Import-Module SqlServer

$dataBases = Get-SqlDatabase -sqlserver "ServerName" | where{$_.IsSystemObject -ne $true}
foreach($db in $dataBases)
	if($db.RecoveryModel -eq [Microsoft.SqlServer.Management.Smo.RecoveryModel]::BulkLogged)
		$db.RecoveryModel = [Microsoft.SqlServer.Management.Smo.RecoveryModel]::Simple;
Read more from Powershell, SQL Server
1 Comment Post a comment
  1. Chris
    Aug 21 2014

    Hi There,

    I need to run this script on multiple servers remotely.
    Is there a way for the script to get a serverlist.txt or .csv with all the remote servers in it and run it on them?

    Kindest Regards,,


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Note: HTML is allowed. Your email address will never be published.

Subscribe to comments

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

%d bloggers like this: