Subversion Repositories camp_sysinfo_client_3

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
72 rodolico 1
#! perl
2
 
3
# https://gallery.technet.microsoft.com/bdf35c43-9415-4e1c-9cfe-e035e38ba694
4
 
96 rodolico 5
# simply exit if this is not Windows
6
BEGIN {
7
$^O eq "MSWin32" || exit;
8
}
9
 
10
use Win32::OLE('in');
72 rodolico 11
use constant wbemFlagReturnImmediately => 0x10; 
12
use constant wbemFlagForwardOnly => 0x20; 
13
 
14
$computer = "."; 
15
$objWMIService = Win32::OLE->GetObject 
16
    ("winmgmts:\\\\$computer\\root\\CIMV2") or die "WMI connection failed.\n"; 
17
$colItems = $objWMIService->ExecQuery 
18
    ("SELECT * FROM Win32_SoftwareFeature","WQL",wbemFlagReturnImmediately | wbemFlagForwardOnly); 
19
 
20
foreach my $objItem (in $colItems) 
21
{ 
22
      print "Accesses: $objItem->{Accesses}\n"; 
23
      print "Attributes: $objItem->{Attributes}\n"; 
24
      print "Caption: $objItem->{Caption}\n"; 
25
      print "Description: $objItem->{Description}\n"; 
26
      print "Identifying Number: $objItem->{IdentifyingNumber}\n"; 
27
      print "Install Date: $objItem->{InstallDate}\n"; 
28
      print "Install State: $objItem->{InstallState}\n"; 
29
      print "Last Use: $objItem->{LastUse}\n"; 
30
      print "Name: $objItem->{Name}\n"; 
31
      print "Product Name: $objItem->{ProductName}\n"; 
32
      print "Status: $objItem->{Status}\n"; 
33
      print "Vendor: $objItem->{Vendor}\n"; 
34
      print "Version: $objItem->{Version}\n"; 
35
      print "\n"; 
36
} 
73 rodolico 37
<STDIN>;