2019-07-22 09:59:47 -04:00
|
|
|
Import-IcingaLib provider\enums;
|
2019-07-18 08:20:23 -04:00
|
|
|
function Get-IcingaMemory ()
|
|
|
|
|
{
|
|
|
|
|
<# Collects the most important Memory informations,
|
|
|
|
|
e.g. name, version, manufacturer#>
|
|
|
|
|
$MEMInformation = Get-CimInstance Win32_PhysicalMemory;
|
|
|
|
|
|
|
|
|
|
[hashtable]$MEMData = @{};
|
|
|
|
|
|
2019-07-22 01:32:52 -04:00
|
|
|
foreach($memory in $MEMInformation) {
|
2019-07-22 09:53:07 -04:00
|
|
|
|
|
|
|
|
$TypeDetail = @();
|
|
|
|
|
$ProviderEnums.MemoryTypeDetail.Keys | Where-Object {
|
|
|
|
|
$_ -band $memory.TypeDetail
|
|
|
|
|
} | ForEach-Object {
|
|
|
|
|
$TypeDetail += $ProviderEnums.MemoryTypeDetail.Get_Item($_);
|
|
|
|
|
};
|
|
|
|
|
|
2019-07-18 08:20:23 -04:00
|
|
|
$MEMData.Add(
|
2019-07-22 01:32:52 -04:00
|
|
|
$memory.tag.trim("Physical Memory"), @{
|
2019-07-18 08:20:23 -04:00
|
|
|
'metadata' = @{
|
2019-07-22 01:32:52 -04:00
|
|
|
'Caption' = $memory.Name;
|
|
|
|
|
'Description'= $memory.Description;
|
|
|
|
|
'Manufacturer'= $memory.Manufacturer;
|
|
|
|
|
'Model'= $memory.Model;
|
|
|
|
|
'OtherIdentifyingInfo'= $memory.OtherIdentifyingInfo;
|
|
|
|
|
'PartNumber'= $memory.PartNumber;
|
|
|
|
|
'SerialNumber'= $memory.SerialNumber;
|
|
|
|
|
'Tag'= $memory.Tag;
|
|
|
|
|
'SMBIOSMemoryType'= $memory.SMBIOSMemoryType;
|
|
|
|
|
'DeviceLocator' = $memory.DeviceLocator;
|
|
|
|
|
'PositionInRow' = $memory.PositionInRow;
|
|
|
|
|
'Version' = $memory.Version;
|
|
|
|
|
'PoweredOn' = $memory.PoweredOn;
|
|
|
|
|
'Status' = $memory.Status;
|
|
|
|
|
'InstallDate' = $memory.InstallDate;
|
|
|
|
|
'BankLabel' = $memory.BankLabel;
|
|
|
|
|
'InterleaveDataDepth' = $memory.InterleaveDataDepth;
|
|
|
|
|
'Attributes' = $memory.Attributes;
|
|
|
|
|
'Replaceable' = $memory.Replaceable;
|
|
|
|
|
'Removable' = $memory.Removable;
|
|
|
|
|
'HotSwappable' = $memory.HotSwappable;
|
2019-07-18 08:20:23 -04:00
|
|
|
'FormFactor' = @{
|
2019-07-22 01:32:52 -04:00
|
|
|
'raw' = $memory.FormFactor;
|
|
|
|
|
'value' = $ProviderEnums.MemoryFormFactor[[int]$memory.FormFactor];
|
2019-07-18 08:20:23 -04:00
|
|
|
};
|
|
|
|
|
'InterleavePosition' = @{
|
2019-07-22 01:32:52 -04:00
|
|
|
'raw' = $memory.InterleavePosition;
|
|
|
|
|
'value' = $ProviderEnums.MemoryInterleavePosition[[int]$memory.InterleavePosition];
|
2019-07-18 08:20:23 -04:00
|
|
|
};
|
|
|
|
|
'MemoryType' = @{
|
2019-07-22 01:32:52 -04:00
|
|
|
'raw' = $memory.MemoryType;
|
|
|
|
|
'value' = $ProviderEnums.MemoryMemoryType[[int]$memory.MemoryType];
|
2019-07-18 08:20:23 -04:00
|
|
|
};
|
|
|
|
|
'TypeDetail' = @{
|
2019-07-22 01:32:52 -04:00
|
|
|
'raw' = $memory.TypeDetail;
|
2019-07-22 09:53:07 -04:00
|
|
|
'value' = $TypeDetail;
|
2019-07-18 08:20:23 -04:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
'specs' = @{
|
2019-07-22 01:32:52 -04:00
|
|
|
'MaxVoltage' = $memory.MaxVoltage;
|
|
|
|
|
'MinVoltage' = $memory.MinVoltage;
|
|
|
|
|
'ConfiguredVoltage' = $memory.ConfiguredVoltage;
|
|
|
|
|
'ConfiguredClockSpeed' = $memory.ConfiguredClockSpeed;
|
|
|
|
|
'TotalWidth' = $memory.TotalWidth;
|
|
|
|
|
'DataWidth' = $memory.DataWidth;
|
|
|
|
|
'Speed' = $memory.Speed;
|
|
|
|
|
'Capacity' = $memory.Capacity;
|
2019-07-18 08:20:23 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $MEMData;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function Get-IcingaMemoryInformation()
|
|
|
|
|
{
|
2019-07-22 04:01:11 -04:00
|
|
|
<# Fetches the information for other more specific Get-IcingaMemory-functions
|
|
|
|
|
e.g. Get-IcingaMemoryMaxVoltage; Get-IcingaMemoryTotalWidth.
|
|
|
|
|
Can be used to fetch information regarding a value of your choice. #>
|
2019-07-18 08:20:23 -04:00
|
|
|
param(
|
|
|
|
|
[string]$Parameter
|
|
|
|
|
);
|
|
|
|
|
$MEMInformation = Get-CimInstance Win32_PhysicalMemory;
|
|
|
|
|
[hashtable]$MEMData = @{};
|
|
|
|
|
|
2019-07-22 01:32:52 -04:00
|
|
|
foreach ($memory in $MEMInformation) {
|
|
|
|
|
$MEMData.Add($memory.tag.trim("Physical Memory"), $memory.$Parameter);
|
2019-07-18 08:20:23 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $MEMData;
|
|
|
|
|
}
|
|
|
|
|
function Get-IcingaMemoryMaxVoltage()
|
|
|
|
|
{
|
|
|
|
|
$MemoryMaxVoltage = Get-IcingaMemoryInformation -Parameter MaxVoltage;
|
|
|
|
|
|
|
|
|
|
return @{'value' = $MemoryMaxVoltage; 'name' = 'MaxVoltage'};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function Get-IcingaMemoryMinVoltage()
|
|
|
|
|
{
|
|
|
|
|
$MemoryMinVoltage = Get-IcingaMemoryInformation -Parameter MinVoltage;
|
|
|
|
|
|
|
|
|
|
return @{'value' = $MemoryMinVoltage; 'name' = 'MinVoltage'};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function Get-IcingaMemoryConfiguredVoltage()
|
|
|
|
|
{
|
|
|
|
|
$MemoryConfiguredVoltage = Get-IcingaMemoryInformation -Parameter ConfiguredVoltage;
|
|
|
|
|
|
|
|
|
|
return @{'value' = $MemoryConfiguredVoltage; 'name' = 'ConfiguredVoltage'};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function Get-IcingaMemoryConfiguredClockSpeed()
|
|
|
|
|
{
|
|
|
|
|
$MemoryConfiguredClockSpeed = Get-IcingaMemoryInformation -Parameter ConfiguredClockSpeed;
|
|
|
|
|
|
|
|
|
|
return @{'value' = $MemoryConfiguredClockSpeed; 'name' = 'ConfiguredClockSpeed'};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function Get-IcingaMemoryTotalWidth()
|
|
|
|
|
{
|
|
|
|
|
$MemoryTotalWidth = Get-IcingaMemoryInformation -Parameter TotalWidth;
|
|
|
|
|
|
|
|
|
|
return @{'value' = $MemoryTotalWidth; 'name' = 'TotalWidth'};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function Get-IcingaMemoryDataWidth()
|
|
|
|
|
{
|
|
|
|
|
$MemoryDataWidth = Get-IcingaMemoryInformation -Parameter DataWidth;
|
|
|
|
|
|
|
|
|
|
return @{'value' = $MemoryDataWidth; 'name' = 'DataWidth'};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function Get-IcingaMemorySpeed()
|
|
|
|
|
{
|
|
|
|
|
$MemorySpeed = Get-IcingaMemoryInformation -Parameter Speed;
|
|
|
|
|
|
|
|
|
|
return @{'value' = $MemorySpeed; 'name' = 'Speed'};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function Get-IcingaMemoryCapacity()
|
|
|
|
|
{
|
|
|
|
|
$MemoryCapacity = Get-IcingaMemoryInformation -Parameter Capacity;
|
|
|
|
|
|
|
|
|
|
return @{'value' = $MemoryCapacity; 'name' = 'Capacity'};
|
|
|
|
|
}
|