I use this for applications. If the update is installed it returns the kb,
otherwise it does not - so it is not installed.

strComputer = "."
HF_ID = "KB2775511"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from
Win32_QuickFixEngineering Where HotFixID='" & HF_ID & "'",,48)
For Each objItem in colItems
    Wscript.Echo "HotFixID: " & objItem.HotFixID
Next

On Wed, Aug 7, 2013 at 9:29 AM, Beardsley, James <[email protected]
> wrote:

>  What’s the best method of querying the list of all installed updates
> (all updates that show up in the Control Panel UI)? I want to create a
> configuration item to either use Powershell or WMI to check if a particular
> Lync update (KB2842627) is installed. On my test machine which has it
> installed, when I look at Installed Updates through Control Panel, it lists
> 5 Lync updates including the one I’m looking for.
>
>
>
>
>
> However, if I run the following Powershell script (I found it online and
> modified it to only show Lync updates) on that same computer, I don’t get
> the results I’m expecting. It only returns 1 Lync update (Security Update
> for Lync 2010 X64 (KB2843160) | MS13-054). I’m trying to figure out why it
> would show one but not the others? If there’s a better way to obtain that
> information programmatically, I’m open to suggestions.
>
>
>
> Function Get-InstalledUpdates($title) {
>
>     $UpdateSession = New-Object -ComObject Microsoft.Update.Session
>
>     $SearchResult = $null
>
>     $UpdateSearcher = $UpdateSession.CreateUpdateSearcher()
>
>     $UpdateSearcher.Online = $true
>
>     $SearchResult = $UpdateSearcher.Search("IsInstalled=1 and
> Type='Software'")
>
>
>
>     $i = 1
>
>     foreach($Update in $SearchResult.Updates)
>
>     {
>
>           If ($Update.Title -like "*$title*") {
>
>         Write-Host "$i) $($Update.Title + " | " +
> $Update.SecurityBulletinIDs)"
>
>         $i += 1
>
>         }
>
>     }
>
> }
>
>
>
> cls
>
>
>
> Get-InstalledUpdates("Lync")
>
>
>
> Thanks!
>  ------------------------------
>
> *IRS Compliance:* Any tax advice contained in this communication
> (including any attachments) is not intended or written to be used, and
> cannot be used, for the purpose of (i) avoiding penalties imposed under the
> Internal Revenue Code or applicable state or local tax law or (ii)
> promoting, marketing, or recommending to another party any transaction or
> matter addressed herein.
> ------------------------------
>
> *Confidentiality Notice:* This e-mail is intended only for the addressee
> named above. It contains information that is privileged, confidential or
> otherwise protected from use and disclosure. If you are not the intended
> recipient, you are hereby notified that any review, disclosure, copying, or
> dissemination of this transmission, or taking of any action in reliance on
> its contents, or other use is strictly prohibited. If you have received
> this transmission in error, please reply to the sender listed above
> immediately and permanently delete this message from your inbox. Thank you
> for your cooperation.
>
>



<<image001.png>>

Reply via email to