none
Can BGinfo show SQL version? RRS feed

All replies

  • yes, sure..

    prepare a vbscript which contains a wmi query:

    sqlwmi.vbs
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

    On Error Resume Next

    Const wbemFlagReturnImmediately = &h10
    Const wbemFlagForwardOnly = &h20

    arrComputers = Array("LOCALHOST")
    For Each strComputer In arrComputers

       Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\Microsoft\SqlServer\ComputerManagement13")
       Set colItems = objWMIService.ExecQuery("SELECT * FROM SqlServiceAdvancedProperty where PropertyName = 'VERSION'", "WQL", _
                                              wbemFlagReturnImmediately + wbemFlagForwardOnly)

       For Each objItem In colItems
          WScript.Echo  objItem.PropertyName & " " & objItem.PropertyStrValue
       Next
    Next

    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

    Then a cmd which will load the script send the output to a file, then load bginfo whith a custom field which takes the content of that file:

    BGINFO.CMD

    >>>>>>>>>>>>>>>>>>>>>>>>>>

    cscript //nologo c:\temp\sqlwmi.vbs >c:\temp\sqlout.txt
    bginfo c:\temp\config.bgi /timer:0
    >>>>>>>>>>>>>>>>>>>>>>>>>>

    IN bginfo you must save a config.bgi with the custom field

    HTH
    -mario

    • Proposed as answer by mariora_ Wednesday, November 27, 2019 2:29 PM
    Wednesday, November 27, 2019 2:29 PM