Prev: Reformat text with a script
Next: Wait for finishing a logout script before logging out / shuttingdown
From: Mick on 5 Feb 2010 05:01 Hello ng How can I get the SQL-Server Version and Edition with WMI or registrykey? This server is patched with SP3 and CU5. The BuildNumber is 10.0.2746.0 now. This RegistryKey give only the basic insallation version, not with updates. [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\100\BIDS\Setup] "Version"="10.0.1600.22" With this SELECT I can list what I want, but I search a WMI querie. SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY ('edition') 10.0.2746.0 Enterprise Edition (64-bit) thanks for your help Mick
From: Richard Mueller [MVP] on 5 Feb 2010 13:55 "Mick" <mw(a)jansen.com> wrote in message news:217D870A-C5F8-4C2A-A076-EBBD58E38B04(a)microsoft.com... > Hello ng > > How can I get the SQL-Server Version and Edition with WMI or registrykey? > This server is patched with SP3 and CU5. The BuildNumber is 10.0.2746.0 > now. > > This RegistryKey give only the basic insallation version, not with > updates. > [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL > Server\100\BIDS\Setup] > "Version"="10.0.1600.22" > > With this SELECT I can list what I want, but I search a WMI querie. > SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY ('edition') > 10.0.2746.0 > Enterprise Edition (64-bit) > > thanks for your help > Mick > I would use the T-SQL @@VERSION function in a query to get the SQL Version. I use ADO in a VBScript program to run SQL statements, but you can also use query analyzer or isql or a similar utility. The T-SQL statement is: SELECT @@VERSION AS Version A VBScript solution could be: ============= ' SQLVersion.vbs ' VBScript program to query SQL Server version. Option Explicit Dim strConnect, adoConnection, adoRecordset, strVersion strConnect = "DRIVER={SQL Server};" _ & "Trusted_Connection=Yes;" _ & "DATABASE=MyDatabase;" _ & "SERVER=MyServer\MyInstance" Set adoConnection = CreateObject("ADODB.Connection") adoConnection.ConnectionString = strConnect adoConnection.Open Set adoRecordset = CreateObject("ADODB.Recordset") Set adoRecordset.ActiveConnection = adoConnection adoRecordset.Source = "SELECT @@VERSION AS Version" adoRecordset.Open Do Until adoRecordset.EOF strVersion = adoRecordset.Fields("Version").Value Wscript.Echo strVersion adoRecordset.MoveNext Loop ' Clean up. adoRecordset.Close adoConnection.Close ======== My connection string assumes a named instance and Windows Integrated Authentication. -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net --
From: Mick on 8 Feb 2010 04:08
"Richard Mueller [MVP]" <rlmueller-nospam(a)ameritech.nospam.net> schrieb im Newsbeitrag Hello Richard Exactly I looked for that! Thanks a lot. Greets from Switzerland. Mick |