Hyper-V MPE 2012 R2 Logical Processor Discovery
HyperVMPE2012R2.LogicalProcessor.Discovery (Discovery)
Element properties: Object Discovery Details: Member Modules:
Source Code: <Discovery ID="HyperVMPE2012R2.LogicalProcessor.Discovery" Enabled="true" Target="MSWinHV2012R2Dis!Microsoft.Windows.HyperV.2012.R2.ServerRole" ConfirmDelivery="true" Remotable="true" Priority="Normal">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="HyperVMPE2012R2.LogicalProcessor">
<Property TypeID="HyperVMPE2012R2.LogicalProcessor" PropertyID="Name"/>
<Property TypeID="MSWinLib!Microsoft.Windows.LogicalDevice" PropertyID="DeviceID"/>
<Property TypeID="MSWinLib!Microsoft.Windows.LogicalDevice" PropertyID="Description"/>
<Property TypeID="SLib!System.Entity" PropertyID="DisplayName"/>
</DiscoveryClass>
</DiscoveryTypes>
<DataSource ID="Script" TypeID="MSWinLib!Microsoft.Windows.TimedScript.DiscoveryProvider">
<IntervalSeconds>86400</IntervalSeconds>
<SyncTime/>
<ScriptName>LogicalProcessorDiscovery.vbs</ScriptName>
<Arguments>$MPElement$ $Target/Id$ $Target/Host/Property[Type="MSWinLib!Microsoft.Windows.Computer"]/PrincipalName$</Arguments>
<ScriptBody><Script>
SetLocale("en-us")
Dim oArgs, oAPI
Dim strComputer
Dim ManagementPack, ComputerID, ComputerName
Dim oDiscoveryData, oInst
Set oArgs = WScript.Arguments
Set oAPI = CreateObject("MOM.ScriptAPI")
'Parameters
ManagementPack = oArgs(0)
ComputerID = oArgs(1)
ComputerName = oArgs(2)
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT name FROM Win32_PerfRawData_PerfOS_Processor WHERE NOT name like '_Total'")
'Creation DiscoveryData object
Set oDiscoveryData = oAPI.CreateDiscoveryData(0,ManagementPack,ComputerID)
For each objitem in colItems
'Instance creation (Object)
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='HyperVMPE2012R2.LogicalProcessor']$")
'Relationship between Object and Windows Computer
Call oInst.AddProperty("$MPElement[Name='MSWinLib!Microsoft.Windows.Computer']/PrincipalName$", ComputerName)
'Instance properties
Call oInst.AddProperty("$MPElement[Name='SLib!System.Entity']/DisplayName$", ComputerName+": Hv LP "+objitem.name)
Call oInst.AddProperty("$MPElement[Name='MSWinLib!Microsoft.Windows.LogicalDevice']/DeviceID$", "Hv LP "+objitem.name)
Call oInst.AddProperty("$MPElement[Name='HyperVMPE2012R2.LogicalProcessor']/Name$", objitem.name)
Call oDiscoveryData.AddInstance(oInst)
'Call oAPI.LogScriptEvent("ADD: ",3180,0, "Added " & ComputerName)
Next
Call oAPI.Return(oDiscoveryData)</Script> </ScriptBody>
<TimeoutSeconds>60</TimeoutSeconds>
</DataSource>
</Discovery>