Advertisement
Ibra86

vNIC-Fix-Win7

Mar 28th, 2018
836
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. Dim strPciFileVersion
  12. Dim WindirFilePath
  13.  
  14. set WshShell = WScript.CreateObject("WScript.Shell")
  15. WindirFilePath = WshShell.ExpandEnvironmentStrings("%WinDir%")
  16.  
  17. Dim fs
  18. Set fs = CreateObject("Scripting.FileSystemObject")
  19.  
  20. strPciFileVersion = fs.getfileversion(WindirFilePath & "\\system32\\drivers\\pci.sys")
  21. Dim strAryFileVersion1
  22.  
  23. strAryFileVersion1 = Split(strPciFileVersion, ".")
  24.  
  25. If (strAryFileVersion1(0) = 6 And strAryFileVersion1(1) = 1 And strAryFileVersion1(2) = 7601) Then
  26.     If (strAryFileVersion1(3) < 17630 Or (strAryFileVersion1(3) > 20000 And strAryFileVersion1(3) < 21744)) Then
  27.         Const HKEY_LOCAL_MACHINE = &H80000002
  28.         Dim oReg : Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
  29.         Dim oShell : Set oShell = CreateObject("WScript.Shell")
  30.         Dim sPath, aSub, sKey, aSubToo, sKeyToo, dwValue, Result, SaveResult
  31.         Dim NotDeleted
  32.         NotDeleted = 0
  33.         ' Get all keys within sPath
  34.        sPath = "SYSTEM\CurrentControlSet\Enum\PCI"
  35.         oReg.EnumKey HKEY_LOCAL_MACHINE, sPath, aSub
  36.         ' Loop through each key
  37.        For Each sKey In aSub
  38.             ' Get all subkeys within the key 'sKey'
  39.            oReg.EnumKey HKEY_LOCAL_MACHINE, sPath & "\" & sKey, aSubToo
  40.             For Each sKeyToo In aSubToo
  41.                 Result = oReg.DeleteKey(HKEY_LOCAL_MACHINE, sPath & "\" & sKey & "\" & sKeyToo & "\" & "\Device Parameters" & "\SlotPersistentInfo")
  42.                 ' Allow failure only if key never existed
  43.                If (Result = 1) Or (Result > 2) Then
  44.                     NotDeleted = 1
  45.                     SaveResult = Result
  46.                 End If
  47.             Next
  48.         Next
  49.         If (NotDeleted > 0) Then
  50.             MsgBox "SlotPersistentInfo keys still exist under HKLM\System\CurrentControlSet\Enum\PCI\<deviceid>\<subdeviceid>\Device Parameters.  Please delete all manually and then install the updates."
  51.         End If
  52.     Else
  53.         MsgBox "Your system is ready to install the updates"
  54.     End If    
  55. Else
  56.     MsgBox "Your system is ready to install the updates"
  57. End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement