Skip to content

Instantly share code, notes, and snippets.

@bidhanahdib
Created July 3, 2021 11:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bidhanahdib/d245411ac309fbc256cd5b4e1d76fdae to your computer and use it in GitHub Desktop.
Save bidhanahdib/d245411ac309fbc256cd5b4e1d76fdae to your computer and use it in GitHub Desktop.
#Note:
#This script downloads and installs the KB3140245 Windows update.
Import-Module BitsTransfer
$arch=(Get-WmiObject -Class Win32_operatingsystem).Osarchitecture
If ($arch -eq "32-bit") {
$kbUrl32 = "http://download.windowsupdate.com/c/msdownload/update/software/updt/2016/04/windows6.1-kb3140245-x86_cdafb409afbe28db07e2254f40047774a0654f18.msu"
$kb32 = "windows6.1-kb3140245-x86_cdafb409afbe28db07e2254f40047774a0654f18.msu"
Start-BitsTransfer -source $kbUrl32
wusa $pwd/$kb32 /log:install.log
}
Else {
$kbUrl64 = "http://download.windowsupdate.com/c/msdownload/update/software/updt/2016/04/windows6.1-kb3140245-x64_5b067ffb69a94a6e5f9da89ce88c658e52a0dec0.msu"
$kb64 = "windows6.1-kb3140245-x64_5b067ffb69a94a6e5f9da89ce88c658e52a0dec0.msu"
Start-BitsTransfer -source $kbUrl64
wusa $pwd/$kb64 /log:install.log
}
#Note:
#This script creates registry keys in the following files:
#HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/CurrentVersion/Internet Settings/WinHttp
#HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/Windows/CurrentVersion/Internet Settings/WinHttp
#HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/TLS 1.1
#HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Protocols/TLS 1.2
$arch=(Get-WmiObject -Class Win32_operatingsystem).Osarchitecture
$reg32bWinHttp = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\WinHttp"
$reg64bWinHttp = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Internet Settings\WinHttp"
$regWinHttpDefault = "DefaultSecureProtocols"
$regWinHttpValue = "0x00000a00"
$regTLS11 = "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Client"
$regTLS12 = "HKLM:SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client"
$regTLSDefault = "DisabledByDefault"
$regTLSValue = "0x00000000"
Clear-Host
Write-Output "Creating Registry Keys...`n"
Write-Output "Creating registry key $reg32bWinHttp\$regWinHttpDefault with value $regWinHttpValue"
IF(!(Test-Path $reg32bWinHttp)) {
New-Item -Path $reg32bWinHttp -Force | Out-Null
New-ItemProperty -Path $reg32bWinHttp -Name $regWinHttpDefault -Value $regWinHttpValue -PropertyType DWORD -Force | Out-Null
}
ELSE {
New-ItemProperty -Path $reg32bWinHttp -Name $regWinHttpDefault -Value $regWinHttpValue -PropertyType DWORD -Force | Out-Null
}
IF($arch -eq "64-bit") {
Write-Output "Creating registry key $reg64bWinHttp\$regWinHttpDefault with value $regWinHttpValue"
IF(!(Test-Path $reg64bWinHttp)) {
New-Item -Path $reg64bWinHttp -Force | Out-Null
New-ItemProperty -Path $reg64bWinHttp -Name $regWinHttpDefault -Value $regWinHttpValue -PropertyType DWORD -Force | Out-Null
}
ELSE {
New-ItemProperty -Path $reg64bWinHttp -Name $regWinHttpDefault -Value $regWinHttpValue -PropertyType DWORD -Force | Out-Null
}
}
Write-Output "Creating registry key $regTLS11\$regTLSDefault with value $regTLSValue"
IF(!(Test-Path $regTLS11)) {
New-Item -Path $regTLS11 -Force | Out-Null
New-ItemProperty -Path $regTLS11 -Name $regTLSDefault -Value $regTLSValue -PropertyType DWORD -Force | Out-Null
}
ELSE {
New-ItemProperty -Path $regTLS11 -Name $regTLSDefault -Value $regTLSValue -PropertyType DWORD -Force | Out-Null
}
Write-Output "Creating registry key $regTLS12\$regTLSDefault with value $regTLSValue"
IF(!(Test-Path $regTLS12)) {
New-Item -Path $regTLS12 -Force | Out-Null
New-ItemProperty -Path $regTLS12 -Name $regTLSDefault -Value $regTLSValue -PropertyType DWORD -Force | Out-Null
}
ELSE {
New-ItemProperty -Path $regTLS12 -Name $regTLSDefault -Value $regTLSValue -PropertyType DWORD -Force | Out-Null
}
Write-Output "`nComplete!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment