Jump to content

Recommended Posts

Posted

how to check if this  Update KB3078601  is instaled or not ?

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Thanks.

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

I think is better use Windows Updates Agent API.

 

Local $oMUS=objCreate('Microsoft.Update.Session');
Local $oSearch=$oMUS.CreateUpdateSearcher


$oSearch.online=False

local $SearchResult= $oSearch.Search("IsInstalled = 1");
local $UpdateCollection  = $SearchResult.Updates

Local $Update =0
Local $IsInstalled=0
For $Update in $UpdateCollection
    ConsoleWrite($Update.Title & @CRLF)
if StringInStr($Update.Title,"KB3078601") Then
    $IsInstalled=1
    ExitLoop
EndIf

Next

MsgBox(0,"",($IsInstalled = 1) ? "KB3078601 is IsInstalled!" : "KB3078601 is not IsInstalled!")

Saludos

Posted (edited)

@JLogan3o13  compatibility.

Jon's suggestion (Minimum supported client Windows Vista)

mine (Windows XP)

As you're checking for a Windows 7 update you can use Jon's suggestion.

Edit: lol fixed Jon name.

Saludos

Edited by Danyfirex
Posted
  On 9/10/2015 at 2:03 PM, Danyfirex said:

@JLogan3o13  compatibility.

Jos's suggestion

You mean Jon not Jos ?

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

ps from cli

$sKB = "KB3078601"
$iPid = run('powershell Get-CimInstance -ClassName Win32_QuickFixEngineering -property * | where HotFixID -like ' & $sKB , "" , @SW_HIDE , 0x2)

 

in use:

msgbox(0, '"KB3078601"' , _CheckKB("KB3078601"))
msgbox(0, '"*078*"' , _CheckKB("*078*"))


Func _CheckKB($sKB)

$iPid = run('powershell Get-CimInstance -ClassName Win32_QuickFixEngineering -property * | where HotFixID -like ' & $sKB , "" , @SW_HIDE , 0x2)

$sOutput = ""

 While 1
        $sOutput &= StdoutRead($iPID)
        If @error Then
            ExitLoop
        EndIf
     WEnd

     If $sOutput = "" then $sOutput = $sKB & " Not Found"

return $sOutput
EndFunc ;CheckKB

 

 

Edited by boththose
changed the query to -like so wildcards are accepted

  Reveal hidden contents

Posted (edited)

@Danyfirex

Funny at my home notebook it's not working properly.

after 30 minutes it's still on 

local $SearchResult= $oSearch.Search("IsInstalled = 1");

and going on.....

 

Edited by mLipok
typo

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

Thry this instead:

Local $oMUS = ObjCreate('Microsoft.Update.Session');
Local $oSearch = $oMUS.CreateUpdateSearcher
Local $iCount = $oSearch.GetTotalHistoryCount()
Local $oHistoryCollection = $oSearch.QueryHistory(0, $iCount)

Local $Update = 0
Local $IsInstalled = 0

For $Update In $oHistoryCollection
    If StringInStr($Update.Title, "KB3078601") Then
        $IsInstalled = 1
        ExitLoop
    EndIf
Next

MsgBox(0, "", ($IsInstalled = 1) ? "KB3078601 is IsInstalled!" : "KB3078601 is not IsInstalled!")

Saludos

Edited by Danyfirex
Posted

@boththose not need to use powershell use objget

local $objWMIService = ObjGet("winmgmts:" & "{impersonationLevel=impersonate}!\\" & "." & "\root\cimv2")
local $oQueryFixes = $objWMIService.ExecQuery("Select * from Win32_QuickFixEngineering")
Local $IsInstalled = 0
For $objFix in $oQueryFixes
    If $objFix.HotFixID= "KB3078601" Then
        $IsInstalled = 1
        ExitLoop
    EndIf
Next

MsgBox(0, "", ($IsInstalled = 1) ? "KB3078601 is IsInstalled!" : "KB3078601 is not IsInstalled!")

Saludos

Posted

Danyfirex,

I was trying to get the code you post above to work using a where clause on the select stmt.  No objects were returned.  Can't post the code cause I'm on a stupid "smart" phone.

Kylomas

 

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Posted

@kylomas windows phone?  I really did not understand you.

 

Saludos

Posted
  On 9/10/2015 at 4:19 PM, Danyfirex said:

Thry this instead:

Local $oMUS = ObjCreate('Microsoft.Update.Session');
Local $oSearch = $oMUS.CreateUpdateSearcher
Local $iCount = $oSearch.GetTotalHistoryCount()
Local $oHistoryCollection = $oSearch.QueryHistory(0, $iCount)

Local $Update = 0
Local $IsInstalled = 0

For $Update In $oHistoryCollection
    If StringInStr($Update.Title, "KB3078601") Then
        $IsInstalled = 1
        ExitLoop
    EndIf
Next

MsgBox(0, "", ($IsInstalled = 1) ? "KB3078601 is IsInstalled!" : "KB3078601 is not IsInstalled!")

Saludos

:)

now this is super fast :)

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

You could just check:

$sKB = "KB3078601"
$iInstalled = ObjGet("winmgmts:\\.\root\cimv2").ExecQuery('SELECT HotFixID FROM Win32_QuickFixEngineering WHERE HotFixID LIKE "' & $sKB & '"').Count()

One liner is possible because with WQL (SQL for WMI) keywords/operators can be used to refine queries.

♡♡♡

.

eMyvnE

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...