Quickly audit the edition of multiple SQL Servers
Today I needed to quickly audit the edition of all our active SQL Server machines. This is a snap with a little bit of Powershell. Just execute the below code, replacing the names of each sql instance as appropriate.
$sqlservers = @("sqlserver1", "sqlserver2", "sqlserver3", "sqlserver4", "sqlserver5", "sqlserver6", "sqlserver7");
# Load smo
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | Out-Null;
# iterate through each sql server
foreach($server in $sqlservers)
{
$srv = New-Object Microsoft.SqlServer.Management.SMO.Server $server;
Write-Host $server "`t`t" $srv.Version $srv.Edition;
}
This will display something looking like below;
sqlserver1 9.0.4035 Standard Edition
sqlserver2 9.0.4035 Developer Edition (64-bit)
sqlserver3 9.0.4035 Developer Edition (64-bit)
sqlserver4 10.0.4000 Standard Edition
sqlserver5 9.0.4035 Standard Edition (64-bit)
sqlserver6 9.0.4035 Standard Edition (64-bit)
sqlserver7 10.0.1600 Developer Edition (64-bit)