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 |
|
101 |
rodolico |
10 |
our $VERSION = '0.1';
|
|
|
11 |
|
96 |
rodolico |
12 |
use Win32::OLE('in');
|
72 |
rodolico |
13 |
use constant wbemFlagReturnImmediately => 0x10;
|
|
|
14 |
use constant wbemFlagForwardOnly => 0x20;
|
|
|
15 |
|
|
|
16 |
$computer = ".";
|
|
|
17 |
$objWMIService = Win32::OLE->GetObject
|
|
|
18 |
("winmgmts:\\\\$computer\\root\\CIMV2") or die "WMI connection failed.\n";
|
|
|
19 |
$colItems = $objWMIService->ExecQuery
|
|
|
20 |
("SELECT * FROM Win32_SoftwareFeature","WQL",wbemFlagReturnImmediately | wbemFlagForwardOnly);
|
|
|
21 |
|
|
|
22 |
foreach my $objItem (in $colItems)
|
|
|
23 |
{
|
|
|
24 |
print "Accesses: $objItem->{Accesses}\n";
|
|
|
25 |
print "Attributes: $objItem->{Attributes}\n";
|
|
|
26 |
print "Caption: $objItem->{Caption}\n";
|
|
|
27 |
print "Description: $objItem->{Description}\n";
|
|
|
28 |
print "Identifying Number: $objItem->{IdentifyingNumber}\n";
|
|
|
29 |
print "Install Date: $objItem->{InstallDate}\n";
|
|
|
30 |
print "Install State: $objItem->{InstallState}\n";
|
|
|
31 |
print "Last Use: $objItem->{LastUse}\n";
|
|
|
32 |
print "Name: $objItem->{Name}\n";
|
|
|
33 |
print "Product Name: $objItem->{ProductName}\n";
|
|
|
34 |
print "Status: $objItem->{Status}\n";
|
|
|
35 |
print "Vendor: $objItem->{Vendor}\n";
|
|
|
36 |
print "Version: $objItem->{Version}\n";
|
|
|
37 |
print "\n";
|
|
|
38 |
}
|
73 |
rodolico |
39 |
<STDIN>;
|