【问题标题】:WMI Query for list of hotfixes installed in a system?WMI 查询系统中安装的修补程序列表?
【发布时间】:2011-04-07 08:28:38
【问题描述】:

我正在编写一个 perl 脚本,它将列出我系统中安装的修补程序,并在开始我的程序之前检查是否有任何必备的修补程序可用;

所以我需要能够枚举系统中的修补程序列表; Here 提到使用 wmic 生成 html 文件。是否可以通过 WMI 查询来做到这一点?

【问题讨论】:

    标签: perl wmi wmi-query hotfix


    【解决方案1】:

    我自己已经找到了答案!! 提供了一个 vbscript 选项here

    perl 版本是这样的..

    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";
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-04-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-27
      • 1970-01-01
      相关资源
      最近更新 更多