Created
November 4, 2014 15:51
-
-
Save jonman364/9bd2cf4915dc8418e9ae to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
Dim objReg | |
Dim hasAccess, hasTspkg, hasSecProv | |
Dim arrSP, SPVal | |
Dim idxLast | |
const HKLM = &H80000002 | |
const KEY_SET_VALUE = &H0002 | |
const LSA = "SYSTEM\CurrentControlSet\Control\Lsa" | |
const SecProv = "SYSTEM\CurrentControlSet\Control\SecurityProviders" | |
Set objReg = GetObject("winmgmts:\\.\root\default:StdRegProv") | |
objReg.CheckAccess HKLM, LSA, KEY_SET_VALUE, hasAccess | |
If Not hasAccess Then | |
WScript.Echo "You do not have access to write to the needed registry key" | |
WScript.Quit | |
End If | |
objReg.GetMultiStringValue HKLM, LSA, "Security Packages", arrSP | |
hasTspkg = False | |
For Each SPVal In arrSP | |
If SPVal = "tspkg" Then | |
hasTspkg = true | |
End If | |
Next | |
If Not hasTspkg Then | |
idxLast = UBound(arrSP) | |
ReDim Preserve arrSP(idxLast + 1) | |
arrSP(idxLast + 1) = "tspkg" | |
objReg.SetMultiStringValue HKLM, LSA, "Security Packages", arrSP | |
End If | |
objReg.GetStringValue HKLM, SecProv, "SecurityProviders", SPVal | |
hasSecProv = False | |
arrSP = Split(SPVal, ", ") | |
For Each SPVal In arrSP | |
If SPVal = "credssp.dll" Then | |
hasSecProv = true | |
End If | |
Next | |
If Not hasSecProv Then | |
SPVal = Join(arrSP, ",") | |
SPVal = SPVal & ", credssp.dll" | |
objReg.SetStringValue HKLM, SecProv, "SecurityProviders", SPVal | |
End If | |
If hasSecProv And hasTspkg Then | |
WScript.Echo "This patch was already applied" | |
Else | |
WScript.Echo "Patch applied." | |
End If |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment