• 0

VBScript - Check to see if Microsoft Hoxfix (KB) is NOT installed


Question

Hello, I have an essential hotfix that has been deployed across our network, however it has not been installed on all the machines, and want to check which machines will need the hotfix.

 

Using VBScript, is there a way that a script that runs at startup that checks whether a specific KB is NOT installed and write the result as a file into a directory?

 

At the moment I have this:

On Error Resume Next
 
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_QuickFixEngineering",,48)
Set objFSO=CreateObject("Scripting.FileSystemObject")
Set wshNetwork = WScript.CreateObject( "WScript.Network" )
strComputerName = wshNetwork.ComputerName
 
 
For Each objItem in colItems
 
If objItem.HotfixID = "KB2590550" then
 
outFile="\\F30-CHI\D$\VBTest\" & strComputerName
Set objFile = objFSO.CreateTextFile(outFile,True)
objFile.Close
 
End If
 
Next

This works perfectly for creating a file if the Hofix IS installed. However I want it to create a file if it is NOT installed.

 

Is this possible?

2 answers to this question

Recommended Posts

  • 0

Add a new variable to store the 'found' state, this variable may store a value of 0 for not found and 1 for found, for example. Initialise it to 0. As you loop through the dataset you're analysing to detect whether the patch is installed, if and when the current object in the loop is the item you're looking for, change the 'found' variable state to 1 to indicate that it's been found. Once you've finished looping through the dataset and therefore have a result as to whether or not the item was found, you can then do something based on that information with a new if statement.

 

For sake of efficiency, you might also like to use a 'break' command to stop looping once you've found the item you're looking for. In VBScript there are multiple 'break' commands, each for breaking out of a different construct - 'Exit For', 'Exit Do', 'Exit Sub'.

patchFound = 0

For Each objItem in colItems
     If objItem.HotfixID = "KB2590550" then
        patchFound = 1
        Exit For
    End If
Next

If patchFound = 0 then
    //Do something (patch missing so install it...)
End If
This topic is now closed to further replies.
  • Posts

    • Running Qbittorrent 5.1.0 on Win11 just fine.
    • I love this game since its first version and it seems that it's only getting better!
    • Oh my goooooooooooooooooooooooooood!!!!!!!!!!!!!!!!!!!!!!!!!!! Yes!!! Super Resident Evil fan here, in case you didn't notice 😅. And Raccoon City is my favorite setting in the entire RE universe. This is a dream come true.
    • Just found this Taskbar Buddy program (still in beta) - 'It lets you turn literally any GIF into your own personal desktop pet.  Thought I would throw some more eyes onto it, (I'm not involved just sharing) https://orange-boy-0.itch.io/taskbar-buddy  
    • Resident Evil Requiem announced for early 2026, taking the story back to Raccoon City by Pulasthi Ariyasinghe The Summer Game Fest showcase today ended with a bang as Capcom delivered the announcement trailer for its next mainline Resident Evil game, finally showing off what it has in store for the ninth entry. Aptly dubbed Resident Evil Requiem, the game is described as a "heart-stopping experience that will chill you to your core." Watch the newly revealed announcement trailer above. The single-player horror game will follow Grace Ashcroft as a protagonist, an FBI agent investigating a series of unusual murders at a hotel named the Remnant Hotel, all linked to her mother's mysterious death. While a new face to the series, she may be related to a character from another Resident Evil game, Outbreak, from back in the day, though Capcom is yet to confirm any ties just yet. Rumors have suggested that Leon is returning in this entry as a playable character too, but the debut trailer did not drop any hints about this project being a dual-protagonist adventure. "A new era of survival horror begins in 2026," says Capcom regarding its latest Resident Evil experience. "Technological advancements combined with the development team's depth of experience combine in a story with rich characters and gameplay that's more immersive than ever before." It looks like the title is returning to its survival horror roots after going for more action-orientated entries in recent times. The original Raccoon City seems to be the setting again too, letting players return to ground zero of the virus outbreak, just in time for the series to hit its 30th anniversary. Resident Evil Requiem is launching across PC, Xbox Series X|S, and PlayStation 5 on February 27, 2026.
  • Recent Achievements

    • Week One Done
      daelos earned a badge
      Week One Done
    • One Month Later
      daelos earned a badge
      One Month Later
    • Mentor
      Karlston went up a rank
      Mentor
    • One Month Later
      EdwardFranciscoVilla earned a badge
      One Month Later
    • One Month Later
      MoyaM earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      492
    2. 2
      snowy owl
      254
    3. 3
      +FloatingFatMan
      252
    4. 4
      ATLien_0
      215
    5. 5
      Xenon
      152
  • Tell a friend

    Love Neowin? Tell a friend!