1

To get PatchCodeGUID I use the script :

$vbsCode = @"
Set msi = CreateObject("WindowsInstaller.Installer")
Set patchlist = msi.Patches("{786970C5-E6F6-4A41-B238-AE25D4B91EEA}")
For Each p In patchlist
    WScript.Echo p
Next
"@

$VBSFile = "$env:TEMP\temp.vbs"

$vbsCode | out-file -FilePath $VBSFile
$PatchList = cscript.exe $VBSFile | Where-Object {$_ -match "^{" }
$VBSFile | Remove-Item -Force -ErrorAction SilentlyContinue

$PatchList

Is it possible to get rid of of VBS and use Powershell only ?

P.S. {786970C5-E6F6-4A41-B238-AE25D4B91EEA} is RTMProductCodeGuid of SCOM agent

1 Answer 1

1

You could use the third party module Windows Installer PowerShell Module. It has the CmdLet Get-MSIPatchInfo which should give you the correct information (more info: http://psmsi.codeplex.com/wikipage?title=Get-MSIPatchInfo.v2.3.0.0&referringTitle=Help.v2.3.0):

Get-MSIPatchInfo [[-ProductCode] <string[]>] [[-PatchCode] <string[]>] [-Filter <PatchStates>] [-UserContext <UserContexts>] [-UserSid <string>] [-Everyone] [<CommonParameters>]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.