25304

WMI Query for list of hotfixes installed in a system?

Question:

I am writing a perl script that will list the hotfixes installed in my system and check if any pre-requisite hotfixes are not available before beginning my program;

So I need to be able to enumerate the list of hotfixes in the system; <a href="http://windowsxp.mvps.org/qfe.htm" rel="nofollow">Here</a> there is a mention of using wmic to generate a html file. Is it possible to do this via a WMI query?

Answer1:

I have figured out the answer for this myself!! There is a vbscript option provided <a href="http://msmvps.com/blogs/athif/archive/2005/11/20/76035.aspx" rel="nofollow">here</a>.

The perl version goes like this..

use Win32::OLE qw( in ); my $machine = "."; my $WMIServices = Win32::OLE->GetObject ( "winmgmts:{impersonationLevel=impersonate,(security)}//$machine/root/cimv2" ) || die "cant call getobject"; my $HotFixCollection = $WMIServices->ExecQuery ( "select * from Win32_QuickFixEngineering" ) || die "Query Failed"; foreach my $hotfix ( in( $HotFixCollection )){ $hotfixID = $hotfix->{HotFixID}; print "Hotfix id is $hotfixID \n"; }

Recommend

  • Getting the source .exe file name from .lnk shortcut in batch script?
  • Not able to start kafka with .\\bin\\windows\\kafka-server-start.bat .\\config\\server.pro
  • Import DBF files into Sql Server
  • .Net: Logical thread and Thread Local Storage?
  • Detect Removable Media Ejection Request in Windows Service
  • How to import the npgsql module?
  • How to get OS version and Device Name of an Android device connected via USB with C#.net (VS2010/4.0
  • Windows API equivalent to “WMIC QFE Get”
  • PHP OCI8 extensions not working with PHP 7 64 bit
  • Share HttpContext code between web and non-web application
  • Using JNA to Get NSWindow from JComponent on mac
  • Programatically get pages count in Microsoft Word documents on linux
  • c#.NET USB device persistent identifier
  • Why are the debugger memory windows not available in VS 2015?
  • Memory usage and time for execution for another process using C#?
  • SetWindowsHookEx does not react on media keys
  • How to disable all widgets inside Panel or inside Composite?
  • SharedPreferences or SQLite Database?
  • Can you perform a UNION without a subquery in SQLAlchemy?
  • PostgreSQL Query without WHERE only ORDER BY and LIMIT doesn't use index
  • swift auto completion not working in Xcode6-Beta
  • How to add a column to a Pandas dataframe made of arrays of the n-preceding values of another column
  • Deserializing XML into class C#
  • Display Images one by one with next and previous functionality
  • jquery mobile loadPage not working
  • Jquery - Jquery Wysiwyg return html as a string
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • How to get icons for entities from eclipse?
  • How to include full .NET prerequisite for Wix Burn installer
  • SQL merge duplicate rows and join values that are different
  • Proper way to use connect-multiparty with express.js?
  • Load html files in TinyMce
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • Why joiner is not used after Sequence generator or Update statergy
  • coudnt use logback because of log4j
  • JaxB to read class hierarchy
  • costura.fody for a dll that references another dll
  • How can I use `wmic` in a Windows PE script?
  • Android Heatmap on canvas or ImageView
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize