Subversion Repositories camp_sysinfo_client_3

Rev

Rev 101 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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