Tuesday, February 13, 2024

T-SQL Tuesday #171 - Describe the Most Recent Issue You Closed

This month T-SQL Tuesday is hosted by Brent Ozar (blog). For this month's T-SQL Tuesday, we are asked to describe the most recent ticket or issue that we closed.

In not so distance past, one of the issues that I closed related to SQL Server was related to the Security Updates for Microsoft SQL Server ODBC and OLE DB Driver that was published in October 2023. Here's the information on the vulnerabilities:

The vulnerabilities are affecting Microsoft ODBC Driver 17 and 18, as well as OLE DB Driver 18 and 19. For more information and also download location for the security update/ hotfix can be found on the following page: Update: Hotfixes released for ODBC and OLE DB drivers for SQL Server

We do an automated security scanning tool that would flag the systems (servers, desktops, latptops, etc.) that haven't been patched. So we can quickly identify the systems that need to be patch and patched those systems quickly.

For this post, I was wondering if there is a quick way to identify Microsoft ODBC and OLE DB drivers that are being installed on the systems. This is for a few reasons:

  • To verify that the automated security scanning tool is flagging the right systems.
  • To verify quickly that the patch has been installed successfully on those system.
  • To capture the current installed version of the Microsoft ODBC and OLE DB drivers, just in case we need to roll back.

One way that I could think of is by using PowerShell and use the Get-WmiObject if you are a Microsoft Windows shop. Here's the PowerShell script that we can use to see if Microsoft OLE DB driver and Microsoft ODBC 17 or 18 driver are installed on the system and it should also give the version number:

Get-WmiObject -Query "select * from win32_product where name = 'Microsoft OLE DB Driver for SQL Server' or name = 'Microsoft ODBC Driver 17 for SQL Server' or name ='Microsoft ODBC Driver 18 for SQL Server'" | Select-Object Name, Version

We can even pass in the computer name onto the PowerShell command to get the information from remote systems:

Get-WmiObject -Query "select * from win32_product where name = 'Microsoft OLE DB Driver for SQL Server' or name = 'Microsoft ODBC Driver 17 for SQL Server' or name ='Microsoft ODBC Driver 18 for SQL Server'" -ComputerName ComputerA,ComputerB,ComputerC | Select-Object PSComputerName, Name, Version

I am sure there are some other methods of identifying the version of Microsoft ODBC and OLE DB drivers that are being installed on your system, such as going to the file property of the dll files and look at the Product Version field as recommended in the Microsoft article. Please feel free to share in the comments if you have any other ways of identifying Microsoft ODBC and OLE DB driver version.

No comments:

Post a Comment