Microsoft.KnowledgeServices.Windows.HyperV.VirtualMachine_Discovery
Microsoft.KnowledgeServices.Windows.HyperV.VirtualMachine_Discovery (Discovery)
Discovery module for class Microsoft.KnowledgeServices.Windows.HyperV.VirtualMachine
Element properties: Object Discovery Details: Member Modules:
Source Code: <Discovery ID="Microsoft.KnowledgeServices.Windows.HyperV.VirtualMachine_Discovery" Enabled="true" Target="MicrosoftWindowsHyperVLibrary!Microsoft.Windows.HyperV.VirtualMachine" ConfirmDelivery="true" Remotable="true" Priority="Normal">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="MicrosoftKnowledgeServicesWindowsHyperVLibrary!Microsoft.KnowledgeServices.Windows.HyperV.VirtualMachine"/>
</DiscoveryTypes>
<DataSource ID="Microsoft.KnowledgeServices.Windows.HyperV.VirtualMachine_Discovery" TypeID="Windows!Microsoft.Windows.TimedPowerShell.DiscoveryProvider">
<IntervalSeconds>44091</IntervalSeconds>
<SyncTime/>
<ScriptName>VirtualMachineExtension.ps1</ScriptName>
<ScriptBody><Script>
param($SourceId,$ManagedEntityId,$KeyPropertyVirtualMachineId,$KeyPropertyServerId,$KeyPropertyPrincipalName)
$ErrorActionPreference = "Stop"
# Set up the arguments
$scriptargs = new-object psobject
$scriptargs | add-member NoteProperty "SourceId" $SourceId
$scriptargs | add-member NoteProperty "ManagedEntityId" $ManagedEntityId
$scriptargs | add-member NoteProperty "KeyPropertyVirtualMachineId" $KeyPropertyVirtualMachineId
$scriptargs | add-member NoteProperty "KeyPropertyServerId" $KeyPropertyServerId
$scriptargs | add-member NoteProperty "KeyPropertyPrincipalName" $KeyPropertyPrincipalName
# Set up the discovery output
$discoveryoutput = new-object psobject
#-----------------------------------------------------
# Main Discovery Function
#-----------------------------------------------------
function AdvisorDiscovery($scriptargs, $discoveryoutput)
{
}
# Create a new discovery data packet
$oAPI = new-object -comObject "MOM.ScriptAPI"
$discoverydata = $oAPI.CreateDiscoveryData(0, $scriptargs.SourceId, $scriptargs.ManagedEntityId)
$instance = $discoverydata.CreateClassInstance("$MPElement[Name='MicrosoftKnowledgeServicesWindowsHyperVLibrary!Microsoft.KnowledgeServices.Windows.HyperV.VirtualMachine']$")
$instance.AddProperty("$MPElement[Name='MicrosoftWindowsHyperVLibrary!Microsoft.Windows.HyperV.VirtualMachine']/VirtualMachineId$", $scriptargs.KeyPropertyVirtualMachineId)
$instance.AddProperty("$MPElement[Name='MicrosoftWindowsHyperVLibrary!Microsoft.Windows.HyperV.ServerRole']/ServerId$", $scriptargs.KeyPropertyServerId)
$instance.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $scriptargs.KeyPropertyPrincipalName)
AdvisorDiscovery $scriptargs $discoveryoutput
</Script> </ScriptBody>
<Parameters>
<Parameter>
<Name>SourceId</Name>
<Value>$MPElement$</Value>
</Parameter>
<Parameter>
<Name>ManagedEntityId</Name>
<Value>$Target/Id$</Value>
</Parameter>
<Parameter>
<Name>KeyPropertyVirtualMachineId</Name>
<Value>$Target/Property[Type="MicrosoftWindowsHyperVLibrary!Microsoft.Windows.HyperV.VirtualMachine"]/VirtualMachineId$</Value>
</Parameter>
<Parameter>
<Name>KeyPropertyServerId</Name>
<Value>$Target/Host/Property[Type="MicrosoftWindowsHyperVLibrary!Microsoft.Windows.HyperV.ServerRole"]/ServerId$</Value>
</Parameter>
<Parameter>
<Name>KeyPropertyPrincipalName</Name>
<Value>$Target/Host/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>300</TimeoutSeconds>
<StrictErrorHandling>false</StrictErrorHandling>
</DataSource>
</Discovery>