none
Detect KB RRS feed

  • Question

  • Hi,

     Please checkl my script. Error: expected ')'


    'Returns if Windows KB2506143 installed
    Option Explicit
    Dim objWMI, strComputer
    strComputer = "."
     
    'Run the query
    Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &strComputer& "\root\cimv2")
     
    Dim listPatches
    Dim patch
    Set listPatches = objWMI.ExecQuery ("Select * from win32_QuickFixEngineering where HotFixID like 'KB2506143'")
    For Each patch in listPatches
    Wscript.echo "Update installed"
    Next
    WScript.Quit


    Tuan

    Tuesday, June 28, 2016 1:25 AM

Answers

  • This would work better:

    Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
    Set listPatches = objWMI.ExecQuery ("Select * from win32_QuickFixEngineering where HotFixID = 'KB2506143'")
    For Each patch in listPatches
    	Wscript.echo "Update installed"
    Next
    

    As Would this:

    Get-Hotfix KB3116278


    \_(ツ)_/

    • Marked as answer by wawakiki Tuesday, June 28, 2016 5:23 PM
    Tuesday, June 28, 2016 2:05 AM

All replies

  • like '%KB2506143%'

    OR

    = 'KB2506143'


    \_(ツ)_/

    Tuesday, June 28, 2016 1:59 AM
  • This would work better:

    Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
    Set listPatches = objWMI.ExecQuery ("Select * from win32_QuickFixEngineering where HotFixID = 'KB2506143'")
    For Each patch in listPatches
    	Wscript.echo "Update installed"
    Next
    

    As Would this:

    Get-Hotfix KB3116278


    \_(ツ)_/

    • Marked as answer by wawakiki Tuesday, June 28, 2016 5:23 PM
    Tuesday, June 28, 2016 2:05 AM
  • Bravo! Thank you

    Tuan

    Tuesday, June 28, 2016 5:24 PM