line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::Win32::Bios; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
59309290
|
use strict; |
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
70
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
70
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
4
|
use English qw(-no_match_vars); |
|
1
|
|
|
|
|
25
|
|
|
1
|
|
|
|
|
20
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
1159
|
use FusionInventory::Agent::Tools::Win32; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
574
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# Only run this module if dmidecode has not been found |
11
|
|
|
|
|
|
|
our $runMeIfTheseChecksFailed = |
12
|
|
|
|
|
|
|
["FusionInventory::Agent::Task::Inventory::Generic::Dmidecode::Bios"]; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub isEnabled { |
15
|
0
|
|
|
0
|
0
|
|
return 1; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub _dateFromIntString { |
19
|
0
|
|
|
0
|
|
|
my ($string) = @_; |
20
|
|
|
|
|
|
|
|
21
|
0
|
0
|
0
|
|
|
|
if ($string && $string =~ /^(\d{4})(\d{2})(\d{2})/) { |
22
|
0
|
|
|
|
|
|
return "$2/$3/$1"; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
return $string; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub doInventory { |
29
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
my $inventory = $params{inventory}; |
32
|
0
|
|
|
|
|
|
my $logger = $params{logger}; |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
my $bios = { |
35
|
|
|
|
|
|
|
BDATE => _dateFromIntString(getRegistryValue( |
36
|
|
|
|
|
|
|
path => "HKEY_LOCAL_MACHINE/Hardware/Description/System/BIOS/BIOSReleaseDate", |
37
|
|
|
|
|
|
|
logger => $logger |
38
|
|
|
|
|
|
|
)) |
39
|
|
|
|
|
|
|
}; |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
foreach my $object (getWMIObjects( |
42
|
|
|
|
|
|
|
class => 'Win32_Bios', |
43
|
|
|
|
|
|
|
properties => [ qw/ |
44
|
|
|
|
|
|
|
SerialNumber Version Manufacturer SMBIOSBIOSVersion BIOSVersion ReleaseDate |
45
|
|
|
|
|
|
|
/ ] |
46
|
|
|
|
|
|
|
)) { |
47
|
0
|
|
|
|
|
|
$bios->{BIOSSERIAL} = $object->{SerialNumber}; |
48
|
0
|
|
|
|
|
|
$bios->{SSN} = $object->{SerialNumber}; |
49
|
0
|
|
|
|
|
|
$bios->{BMANUFACTURER} = $object->{Manufacturer}; |
50
|
0
|
|
0
|
|
|
|
$bios->{BVERSION} = $object->{SMBIOSBIOSVersion} || |
51
|
|
|
|
|
|
|
$object->{BIOSVersion} || |
52
|
|
|
|
|
|
|
$object->{Version}; |
53
|
0
|
|
|
|
|
|
$bios->{BDATE} = _dateFromIntString($object->{ReleaseDate}); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
foreach my $object (getWMIObjects( |
57
|
|
|
|
|
|
|
class => 'Win32_ComputerSystem', |
58
|
|
|
|
|
|
|
properties => [ qw/ |
59
|
|
|
|
|
|
|
Manufacturer Model |
60
|
|
|
|
|
|
|
/ ] |
61
|
|
|
|
|
|
|
)) { |
62
|
0
|
|
|
|
|
|
$bios->{SMANUFACTURER} = $object->{Manufacturer}; |
63
|
0
|
|
|
|
|
|
$bios->{SMODEL} = $object->{Model}; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
foreach my $object (getWMIObjects( |
67
|
|
|
|
|
|
|
class => 'Win32_SystemEnclosure', |
68
|
|
|
|
|
|
|
properties => [ qw/ |
69
|
|
|
|
|
|
|
SerialNumber SMBIOSAssetTag |
70
|
|
|
|
|
|
|
/ ] |
71
|
|
|
|
|
|
|
)) { |
72
|
0
|
|
|
|
|
|
$bios->{ENCLOSURESERIAL} = $object->{SerialNumber} ; |
73
|
0
|
0
|
|
|
|
|
$bios->{SSN} = $object->{SerialNumber} unless $bios->{SSN}; |
74
|
0
|
|
|
|
|
|
$bios->{ASSETTAG} = $object->{SMBIOSAssetTag}; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
foreach my $object (getWMIObjects( |
78
|
|
|
|
|
|
|
class => 'Win32_BaseBoard', |
79
|
|
|
|
|
|
|
properties => [ qw/ |
80
|
|
|
|
|
|
|
SerialNumber Product Manufacturer |
81
|
|
|
|
|
|
|
/ ] |
82
|
|
|
|
|
|
|
)) { |
83
|
0
|
|
|
|
|
|
$bios->{MSN} = $object->{SerialNumber}; |
84
|
0
|
|
|
|
|
|
$bios->{MMODEL} = $object->{Product}; |
85
|
0
|
0
|
|
|
|
|
$bios->{SSN} = $object->{SerialNumber} |
86
|
|
|
|
|
|
|
unless $bios->{SSN}; |
87
|
0
|
0
|
|
|
|
|
$bios->{SMANUFACTURER} = $object->{Manufacturer} |
88
|
|
|
|
|
|
|
unless $bios->{SMANUFACTURER}; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
0
|
|
|
|
|
|
foreach (keys %$bios) { |
93
|
0
|
0
|
|
|
|
|
$bios->{$_} =~ s/\s+$// if $bios->{$_}; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
0
|
|
|
|
|
|
$inventory->setBios($bios); |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
SWITCH: { |
99
|
0
|
0
|
0
|
|
|
|
if ( |
|
0
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
100
|
|
|
|
|
|
|
($bios->{VERSION} && $bios->{VERSION} eq 'VirtualBox') || |
101
|
|
|
|
|
|
|
($bios->{MMODEL} && $bios->{MMODEL} eq 'VirtualBox') |
102
|
|
|
|
|
|
|
) { |
103
|
0
|
|
|
|
|
|
$inventory->setHardware ({ |
104
|
|
|
|
|
|
|
VMSYSTEM => 'VirtualBox' |
105
|
|
|
|
|
|
|
}); |
106
|
0
|
|
|
|
|
|
last SWITCH; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
0
|
0
|
0
|
|
|
|
if ( |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
110
|
|
|
|
|
|
|
($bios->{BIOSSERIAL} && $bios->{BIOSSERIAL} =~ /VMware/i) || |
111
|
|
|
|
|
|
|
($bios->{SMODEL} && $bios->{SMODEL} eq 'VirtualBox') |
112
|
|
|
|
|
|
|
) { |
113
|
0
|
|
|
|
|
|
$inventory->setHardware ({ |
114
|
|
|
|
|
|
|
VMSYSTEM => 'VMware' |
115
|
|
|
|
|
|
|
}); |
116
|
0
|
|
|
|
|
|
last SWITCH; |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
0
|
0
|
0
|
|
|
|
if ( |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
120
|
|
|
|
|
|
|
($bios->{SMANUFACTURER} && $bios->{SMANUFACTURER} eq 'Xen') || |
121
|
|
|
|
|
|
|
($bios->{BMANUFACTURER} && $bios->{BMANUFACTURER} eq 'Xen') |
122
|
|
|
|
|
|
|
) { |
123
|
0
|
|
|
|
|
|
$inventory->setHardware ({ |
124
|
|
|
|
|
|
|
VMSYSTEM => 'Xen' |
125
|
|
|
|
|
|
|
}); |
126
|
0
|
|
|
|
|
|
last SWITCH; |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
1; |