Saw this on twitter and thought I would throw it up on the blog. Easier than responding on twitter.
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | Out-Null; $SQLServerInstance = "MSSQLSERVER" $srv = New-Object "Microsoft.SqlServer.Management.Smo.Server" $SQLServerInstance $srv.JobServer.MaximumHistoryRows = 1002 $srv.JobServer.Alter()
You can manipulate most if not all SQL Server configurations through SMO. This simple post has inspired me a bit. I think it would be useful to show how I came to find the information I needed to modify this setting. The cool thing about PowerShell is that it’s in there. All the tools you need already exist. Look back for an expansion of this post in the near future.