Windows CPU 검색

Microsoft.Windows.Server.10.0.CPUDiscovery.ModuleType (DataSourceModuleType)

Windows Server에서 개별 CPU를 검색합니다.

Element properties:

TypeDataSourceModuleType
IsolationAny
AccessibilityInternal
RunAsDefault
OutputTypeSystem.Discovery.Data

Member Modules:

ID Module Type TypeId RunAs 
Scheduler DataSource System.Discovery.Scheduler Default
ScriptProbe ProbeAction Microsoft.Windows.Server.10.0.PowerShellDiscoveryProbe Default

Overrideable Parameters:

IDParameterTypeSelectorDisplay NameDescription
IntervalSecondsint$Config/IntervalSeconds$간격(초)
TimeoutSecondsint$Config/TimeoutSeconds$시간 제한(초)

Source Code:

<DataSourceModuleType ID="Microsoft.Windows.Server.10.0.CPUDiscovery.ModuleType" Accessibility="Internal">
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ComputerName" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ComputerID" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="IntervalSeconds" type="xsd:integer"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="TimeoutSeconds" type="xsd:int"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int"/>
<OverrideableParameter ID="TimeoutSeconds" ParameterType="int" Selector="$Config/TimeoutSeconds$"/>
</OverrideableParameters>
<ModuleImplementation>
<Composite>
<MemberModules>
<DataSource ID="Scheduler" TypeID="System!System.Discovery.Scheduler">
<Scheduler>
<SimpleReccuringSchedule>
<Interval Unit="Seconds">$Config/IntervalSeconds$</Interval>
</SimpleReccuringSchedule>
<ExcludeDates/>
</Scheduler>
</DataSource>
<ProbeAction ID="ScriptProbe" TypeID="Microsoft.Windows.Server.10.0.PowerShellDiscoveryProbe">
<ScriptName>Microsoft.Windows.Server.DiscoverWindows.10.0.CPU.ps1</ScriptName>
<PSparam>param ($SourceID, $ManagedEntityId, $TargetComputer, $TargetComputerID)</PSparam>
<ScriptBody><Script>
#Copyright (c) Microsoft Corporation. All rights reserved.

# Parameters that should be passed to this script
# 0 MPElement ID ($MPElement$)
# 1 Target Id for ME this rule is running against ($Target/Id$)
# 2 Computer (FQDN) that the CPU will be hosted on
# 3 Computer ID (Key) that the CPU will be hosted on

Function Main()
{
$oDiscoveryData = $momAPI.CreateDiscoveryData(0, $SourceID, $ManagedEntityId)

if ((DoDiscovery $TargetComputer $TargetComputerID $oDiscoveryData) -ne 0)
{
$oDiscoveryData = $momAPI.CreateDiscoveryData(0, $SourceID, $ManagedEntityId)
$oDiscoveryData.IsSnapshot = $false
}

$oDiscoveryData
}

Function DoDiscovery
{
param ([string]$sTargetComputer, [string]$sTargetComputerID, $oDisc)

$ProcessorTypes = @{[Uint16]1 ="Other";[Uint16]2 = "Unknown";[Uint16]3 ="Central Processor";[Uint16]4 = "Math Processor";[Uint16]5 = "DSP Processor";[Uint16]6 = "Video Processor"}
$CpuFamilys = @{
[Uint16]1="Other";[Uint16]2="Unknown";[Uint16]3="8086";[Uint16]4="80286";[Uint16]5="80386";[Uint16]6="80486";[Uint16]7="8087";[Uint16]8="80287";[Uint16]9="80387";[Uint16]10="80487";[Uint16]11="Pentium brand";
[Uint16]12="Pentium Pro";[Uint16]13="Pentium II";[Uint16]14="Pentium processor with MMX technology";[Uint16]15="Celeron";[Uint16]16="Pentium II Xeon";[Uint16]17="Pentium III";[Uint16]18="M1 Family";[Uint16]19="M2 Family";
[Uint16]24="K5 Family";[Uint16]25="K6 Family";[Uint16]26="K6-2";[Uint16]27="K6-3";[Uint16]28="AMD Athlon Processor Family";[Uint16]29="AMD Duron Processor";[Uint16]30="AMD29000 Family";[Uint16]31="K6-2+";[Uint16]32="Power PC Family";
[Uint16]33="Power PC 601";[Uint16]34="Power PC 603";[Uint16]35="Power PC 603+";[Uint16]36="Power PC 604";[Uint16]37="Power PC 620";[Uint16]38="Power PC X704";[Uint16]39="Power PC 750";[Uint16]48="Alpha Family";[Uint16]49="Alpha 21064";
[Uint16]50="Alpha 21066";[Uint16]51="Alpha 21164";[Uint16]52="Alpha 21164PC";[Uint16]53="Alpha 21164a";[Uint16]54="Alpha 21264";[Uint16]55="Alpha 21364";[Uint16]64="MIPS Family";[Uint16]65="MIPS R4000";[Uint16]66="MIPS R4200";[Uint16]67="MIPS R4400";
[Uint16]68="MIPS R4600";[Uint16]69="MIPS R10000";[Uint16]80="SPARC Family";[Uint16]81="SuperSPARC";[Uint16]82="microSPARC II";[Uint16]83="microSPARC IIep";[Uint16]84="UltraSPARC";[Uint16]85="UltraSPARC II";[Uint16]86="UltraSPARC IIi";[Uint16]87="UltraSPARC III";
[Uint16]88="UltraSPARC IIIi";[Uint16]96="68040";[Uint16]97="68xxx Family";[Uint16]98="68000";[Uint16]99="68010";[Uint16]100="68020";[Uint16]101="68030";[Uint16]112="Hobbit Family";[Uint16]120="Crusoe TM5000 Family";[Uint16]121="Crusoe TM3000 Family";
[Uint16]122="Efficeon TM8000 Family";[Uint16]128="Weitek";[Uint16]130="Itanium Processor";[Uint16]131="AMD Athlon 64 Processor Family";[Uint16]132="AMD Opteron Family";[Uint16]144="PA-RISC Family";[Uint16]145="PA-RISC 8500";[Uint16]146="PA-RISC 8000";
[Uint16]147="PA-RISC 7300LC";[Uint16]148="PA-RISC 7200";[Uint16]149="PA-RISC 7100LC";[Uint16]150="PA-RISC 7100";[Uint16]160="V30 Family";[Uint16]176="Pentium III Xeon";[Uint16]177="Pentium III Processor with Intel SpeedStep Technology";[Uint16]178="Pentium 4";
[Uint16]179="Intel Xeon";[Uint16]180="AS400 Family";[Uint16]181="Intel Xeon processor MP";[Uint16]182="AMD AthlonXP Family";[Uint16]183="AMD AthlonMP Family";[Uint16]184="Intel Itanium 2";[Uint16]185="Intel Pentium M Processor";[Uint16]190="K7";
[Uint16]198="Intel Corei7-2760QM";[Uint16]200="IBM390 Family";[Uint16]201="G4";[Uint16]202="G5";[Uint16]203="G6";[Uint16]204="z/Architecture base";[Uint16]250="i860";[Uint16]251="i960";[Uint16]260="SH-3";[Uint16]261="SH-4";[Uint16]280="ARM";
[Uint16]281="StrongARM";[Uint16]300="6x86";[Uint16]301="MediaGX";[Uint16]302="MII";[Uint16]320="WinChip";[Uint16]350="DSP";[Uint16]500="Video Processor"
}

$error.Clear()
$WMISet = WMIGetInstanceNoAbort $sTargetComputer "root\cimv2" "Win32_Processor"
if (0 -ne $error.Count)
{
return 1
}

$LcpuNumber = [UInt32]0
$errorCount = 0
$ErrorActionPreference="SilentlyContinue"

foreach ($owObj in $WMISet)
{
$ProcessorType = $ProcessorTypes[$owObj.ProcessorType]
$CpuFamily = $CpuFamilys[$owObj.Family]
$PerfInstance = $owObj.DeviceID.Substring(3)

$ProcessorType = Get-StringProperty -Property $ProcessorType
$CpuFamily = Get-StringProperty -Property $CpuFamily
$PerfInstance = Get-StringProperty -Property $PerfInstance
$PCache = Get-CpuCacheSize -oCpu $owObj

$NumberOfLCpu = $owObj.NumberOfLogicalProcessors
$oCPUInstance = $oDisc.CreateClassInstance("$MPElement[Name='Microsoft.Windows.Server.10.0.Processor']$")
$oCPUInstance.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $sTargetComputerID)
$oCPUInstance.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.LogicalDevice']/DeviceID$", $owObj.DeviceID)
$oCPUInstance.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.LogicalDevice']/Name$", $owObj.Name)
$oCPUInstance.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.LogicalDevice']/Description$", $owObj.Description)
$oCPUInstance.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Processor']/Family$", $CpuFamily)
$oCPUInstance.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Processor']/MaxClockSpeed$", $owObj.MaxClockSpeed)
$oCPUInstance.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Processor']/Type$", $ProcessorType)
$oCPUInstance.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Processor']/PCache$", $PCache)
$oCPUInstance.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Processor']/CPUKey$", $owObj.ProcessorId)
$oCPUInstance.AddProperty("$MPElement[Name='WindowsServer!Microsoft.Windows.Server.Processor']/PerfmonInstance$", $PerfInstance )
$oCPUInstance.AddProperty("$MPElement[Name='WindowsServer!Microsoft.Windows.Server.Processor']/Speed$", $owObj.CurrentClockSpeed)
$oCPUInstance.AddProperty("$MPElement[Name='WindowsServer!Microsoft.Windows.Server.Processor']/Manufacturer$", $owObj.Manufacturer)
$oCPUInstance.AddProperty("$MPElement[Name='WindowsServer!Microsoft.Windows.Server.Processor']/DataWidth$", $owObj.DataWidth)
$oCPUInstance.AddProperty("$MPElement[Name='WindowsServer!Microsoft.Windows.Server.Processor']/Revision$", $owObj.Revision)
$oCPUInstance.AddProperty("$MPElement[Name='WindowsServer!Microsoft.Windows.Server.Processor']/Version$", $owObj.Version)

if (0 -eq $error.Count)
{
$oDisc.AddInstance($oCPUInstance)
}

$errorCount += $error.Count
$error.Clear()

for ($i = [UInt32]0; $i -lt $NumberOfLCpu; $i++)
{
$LcpuId = "CPU $PerfInstance Logical Cpu $i"
$LcpuPerfInstance = $LcpuNumber + $i
$oLCPUInstance = $oDisc.CreateClassInstance("$MPElement[Name='Microsoft.Windows.Server.10.0.LogicalProcessor']$")
$oLCPUInstance.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $sTargetComputerID)
$oLCPUInstance.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.LogicalDevice']/DeviceID$", $owObj.DeviceID)
$oLCPUInstance.AddProperty("$MPElement[Name='Microsoft.Windows.Server.10.0.LogicalProcessor']/DeviceID$",$LcpuId)
$oLCPUInstance.AddProperty("$MPElement[Name='Microsoft.Windows.Server.10.0.LogicalProcessor']/Name$", $owObj.Name)
$oLCPUInstance.AddProperty("$MPElement[Name='Microsoft.Windows.Server.10.0.LogicalProcessor']/Description$", $owObj.Description)
$oLCPUInstance.AddProperty("$MPElement[Name='Microsoft.Windows.Server.10.0.LogicalProcessor']/Manufacturer$", $owObj.Manufacturer)
$oLCPUInstance.AddProperty("$MPElement[Name='Microsoft.Windows.Server.10.0.LogicalProcessor']/Speed$", $owObj.CurrentClockSpeed)
$oLCPUInstance.AddProperty("$MPElement[Name='Microsoft.Windows.Server.10.0.LogicalProcessor']/MaxClockSpeed$", $owObj.MaxClockSpeed)
$oLCPUInstance.AddProperty("$MPElement[Name='Microsoft.Windows.Server.10.0.LogicalProcessor']/PerfmonInstance$", $LcpuPerfInstance.ToString() )

if (0 -eq $error.Count)
{
$oDisc.AddInstance($oLCPUInstance)
}

$errorCount += $error.Count
$error.Clear()



}

$LcpuNumber = $LcpuNumber + $NumberOfLCpu
}

return $errorCount
}


Function Get-CpuCacheSize($oCpu)
{
$CacheSize = 0

if ([string]::IsNullOrEmpty($oCpu) )
{
return "$CacheSize"
}

$L2Cache = $oCpu.L2CacheSize
$L3Cache = $oCpu.L3CacheSize

if ([string]::IsNullOrEmpty($L2Cache))
{
$L2Cache = 0
}

if ([string]::IsNullOrEmpty($L3Cache))
{
$L3Cache = 0
}

$CacheSize = $L2Cache + $L3Cache

return "$CacheSize"
}

Main

</Script></ScriptBody>
<Parameters>
<Parameter>
<Name>SourceID</Name>
<Value>$MPElement$</Value>
</Parameter>
<Parameter>
<Name>ManagedEntityId</Name>
<Value>$Target/Id$</Value>
</Parameter>
<Parameter>
<Name>TargetComputer</Name>
<Value>$Config/ComputerName$</Value>
</Parameter>
<Parameter>
<Name>TargetComputerID</Name>
<Value>$Config/ComputerID$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
</ProbeAction>
</MemberModules>
<Composition>
<Node ID="ScriptProbe">
<Node ID="Scheduler"/>
</Node>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.Discovery.Data</OutputType>
</DataSourceModuleType>