Advertisement
Ibra86

NIC-Fix-KB3125574

Apr 18th, 2018
674
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. On Error Resume Next
  2. key = CreateObject("WScript.Shell").RegRead("HKEY_USERS\S-1-5-19\")
  3. If err.number <> 0 Then
  4.  Set UAC = CreateObject("Shell.Application")
  5.  UAC.ShellExecute "wscript.exe", Chr(34) & _
  6.  WScript.ScriptFullName & Chr(34), "", "runas", 1
  7.  WScript.Quit()
  8. End If
  9. On Error Resume Next
  10.  
  11. Const HKEY_LOCAL_MACHINE = &H80000002
  12. Dim oReg : Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
  13. Dim oShell : Set oShell = CreateObject("WScript.Shell")
  14. Dim sPath, aSub, sKey, aSubToo, sKeyToo, dwValue, Result, SaveResult
  15. Dim NotDeleted
  16.  
  17. NotDeleted = 0
  18.  
  19. ' Get all keys within sPath
  20. sPath = "SYSTEM\CurrentControlSet\Enum\PCI"
  21. oReg.EnumKey HKEY_LOCAL_MACHINE, sPath, aSub
  22.  
  23. ' Loop through each key
  24. For Each sKey In aSub
  25.     ' Get all subkeys within the key 'sKey'
  26.    oReg.EnumKey HKEY_LOCAL_MACHINE, sPath & "\" & sKey, aSubToo
  27.     For Each sKeyToo In aSubToo
  28.       Result = oReg.DeleteKey(HKEY_LOCAL_MACHINE, sPath & "\" & sKey & "\" & sKeyToo & "\" & "\Device Parameters" & "\SlotPersistentInfo")
  29.       ' Allow failure only if key never existed
  30.      If (Result = 1) Or (Result > 2) Then
  31.         NotDeleted = 1
  32.         SaveResult = Result
  33.       End If
  34.     Next
  35. Next
  36.  
  37. If (NotDeleted > 0) Then
  38.   MsgBox "One or more SlotPersistentInfo keys still exist under HKLM\System\CurrentControlSet\Enum\PCI\<deviceid>\<subdeviceid>\Device Parameters.  Please delete all manually and then install the updates " & Result
  39. Else
  40.   MsgBox "Your system is ready to install the updates"
  41. End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement