[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 524
  • Last Modified:

Check SQL Server edition with SMO

Hello,

I am looking for a script SMO for checking MS SQL Server edition before compress backups.

Thanks

bibi
0
bibi92
Asked:
bibi92
  • 2
  • 2
1 Solution
 
Éric MoreauSenior .Net ConsultantCommented:
0
 
bibi92Author Commented:
Thanks, I know that but I search to check with SMO.
0
 
Éric MoreauSenior .Net ConsultantCommented:
0
 
Rainer JeschorCommented:
Hi,
here we go (small console application in C#):

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SqlServer.Management;
using Microsoft.SqlServer.Server;
using Microsoft.SqlServer.Management.Smo;

namespace EE_SMOServerInfo
{
    class Program
    {
        static void Main(string[] args)
        {
            Server sqlServerToVerify = new Server("mss");
            sqlServerToVerify.ConnectionContext.LoginSecure = false; //Set true for Windows
            sqlServerToVerify.ConnectionContext.Login = "sa";
            sqlServerToVerify.ConnectionContext.Password = "grOOvy2410!";
            Console.WriteLine("SQL Version: " + sqlServerToVerify.Version.ToString());
            Console.WriteLine("SQL Edition: " + sqlServerToVerify.Edition);
            Console.ReadKey();
        }
    }
}

Open in new window


You would need the references to SQL SMO.
Result see this screenshot:

Progam and result
SMO Downloads:
http://www.microsoft.com/en-us/download/details.aspx?id=29065
(you would need the CLR and SMO files)

SMO Programming:
http://msdn.microsoft.com/en-us/library/ms162169

HTH
Rainer
0
 
bibi92Author Commented:
Thanks bibi
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now