Skip to content

Commit fe52d93

Browse files
author
Amit Banerjee
authored
Create check-client-updates.ps1
PowerShell script for identifying the TLS 1.2 SQL Server client/server updates required for SQL Server.
1 parent 9e816e8 commit fe52d93

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Helper functions to check if TLS 1.2 updates are required
2+
# Script currently supports checking for the following:
3+
# a. Check if SQL Server Native Client can support TLS 1.2
4+
# b. Check if Microsoft ODBC Driver for SQL Server can support TLS 1.2
5+
# This script is restricted to work on x64 and x86 platforms
6+
Function Check-Sqlncli()
7+
{
8+
# Fetch the different Native Client installations found on the machine
9+
$sqlncli = Get-WmiObject -Class Win32_Product | Where-Object {$_.Name -like "*Native Client*"} | Select Name,Version
10+
# Check and report if an update is required for each entry found
11+
foreach ($cli in $sqlncli)
12+
{
13+
# SQL Server 2012 and 2014
14+
if ($cli.Version.Split(".")[2] -lt 6538 -and $cli.Version.Split(".")[0] -eq 11)
15+
{
16+
Write-Host $cli.Name "with version" $cli.Version " needs to be updated to use TLS 1.2" -ForegroundColor Red
17+
}
18+
# SQL Server 2008
19+
elseif ($cli.Version.Split(".")[2] -lt 6543 -and $cli.Version.Split(".")[1] -eq 0 -and $cli.Version.Split(".")[0] -eq 10)
20+
{
21+
Write-Host $cli.Name "with version" $cli.Version " needs to be updated to use TLS 1.2" -ForegroundColor Red
22+
}
23+
# SQL Server 2008 R2
24+
elseif ($cli.Version.Split(".")[2] -lt 6537 -and $cli.Version.Split(".")[1] -eq 50 -and $cli.Version.Split(".")[0] -eq 10)
25+
{
26+
Write-Host $cli.Name "with version" $cli.Version " needs to be updated to use TLS 1.2" -ForegroundColor Red
27+
}
28+
else
29+
{
30+
Write-Host $cli.Name "with version" $cli.Version " supports TLS 1.2" -ForegroundColor Green
31+
}
32+
}
33+
}
34+
35+
Function Check-SqlODBC()
36+
{
37+
# Fetch the different MS SQL ODBC installations found on the machine
38+
$sqlodbc = Get-WmiObject -Class Win32_Product | Where-Object {$_.Name -like "*ODBC*"} | Select Name,Version
39+
# Check and report if an update is required for each entry found
40+
foreach ($cli in $sqlodbc)
41+
{
42+
# SQL Server 2012 and 2014
43+
if ($cli.Version.Split(".")[2] -lt 4219 -and $cli.Version.Split(".")[0] -eq 12)
44+
{
45+
Write-Host $cli.Name "with version" $cli.Version " needs to be updated to use TLS 1.2" -ForegroundColor Red
46+
}
47+
else
48+
{
49+
Write-Host $cli.Name "with version" $cli.Version " supports TLS 1.2" -ForegroundColor Green
50+
}
51+
}
52+
}
53+
54+
# Call the functions
55+
Check-Sqlncli
56+
Check-SqlODBC

0 commit comments

Comments
 (0)