Discovers the DHCP IPv4 Scopes Runtime
DHCP Server 2012 IPV4 Scopes Runtime Discovery get the DHCP 2012 Scopes Runtime
These are the parameters that we could override, if need it:
Interval Seconds: Amount of Seconds for each execution
Sync Time: Time expressed with this format: "hh:mm" since you will like to start the execution.
Timeout Seconds: Amount of seconds to wait until cancel execution for "timeout reasons."
Target | Microsoft.Windows.DHCPServer.2012.Server |
Enabled | False |
Frequency | 86400 |
Remotable | False |
Discovered Classes and their attribuets: |
---|
|
ID | Module Type | TypeId | RunAs |
---|---|---|---|
DS4 | DataSource | Microsoft.Windows.TimedPowerShell.DiscoveryProvider | System.PrivilegedMonitoringAccount |
<Discovery ID="Microsoft.Windows.DHCPServer.2012.DiscoverIPv4ScopesRuntime" Enabled="false" Target="Microsoft.Windows.DHCPServer.2012.Server" ConfirmDelivery="true" Remotable="true" Priority="Normal">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="Microsoft.Windows.DHCPServer.2012.IPv4ScopesRuntime">
<Property TypeID="System!System.Entity" PropertyID="DisplayName"/>
<Property TypeID="DHCP!Microsoft.Windows.DHCPServer.Library.DHCPComponent" PropertyID="Name"/>
<Property TypeID="DHCP!Microsoft.Windows.DHCPServer.Library.Server" PropertyID="Name"/>
<Property TypeID="Windows!Microsoft.Windows.Computer" PropertyID="PrincipalName"/>
</DiscoveryClass>
</DiscoveryTypes>
<DataSource ID="DS4" RunAs="System!System.PrivilegedMonitoringAccount" TypeID="Windows!Microsoft.Windows.TimedPowerShell.DiscoveryProvider">
<IntervalSeconds>86400</IntervalSeconds>
<SyncTime/>
<ScriptName>DiscoverDHCPIPv4ScopesRuntime.ps1</ScriptName>
<ScriptBody>
param ([String] $ElementID, [String] $TargetID, [String] $PrincipalName)
$SCRIPT_NAME = "DiscoverDHCPIPv4ScopesRuntime"
$ErrorActionPreference = "Stop"
# Event type constants
$EVENT_TYPE_LOG = 0
$EVENT_TYPE_ERROR = 1
$EVENT_TYPE_WARNING = 2
$EVENT_TYPE_INFORMATION = 4
# Typed property bag constants
$PROPERTY_TYPE_ALERT = 0
$PROPERTY_TYPE_EVENT = 1
$PROPERTY_TYPE_PERFORMANCE = 2
$PROPERTY_TYPE_STATE = 3
# State type constants
$STATE_SUCCESS = "Success"
$STATE_WARNING = "Warning"
$STATE_ERROR = "Error"
$momAPI = new-object -comObject MOM.ScriptAPI
$ComputerKey = "$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$"
$DisplayName = "$MPElement[Name='System!System.Entity']/DisplayName$"
$ServerName = "$MPElement[Name='DHCP!Microsoft.Windows.DHCPServer.Library.Server']/Name$"
$ComponentName = "$MPElement[Name='DHCP!Microsoft.Windows.DHCPServer.Library.DHCPComponent']/Name$"
Write-Host "$SCRIPT_NAME - Executing IPv4 Scopes Runtime Discovery Powershell Script"
try
{
$discoveryData = $momAPI.CreateDiscoveryData(0, $ElementID, $TargetID)
$IPV4Scopes = Get-DhcpServerv4Scope
if($IPV4Scopes -ne $null)
{
$IPV4ScopesRuntime = $discoveryData.CreateClassInstance("$MPElement[Name='Microsoft.Windows.DHCPServer.2012.IPv4ScopesRuntime']$")
$IPV4ScopesRuntime.AddProperty($ComputerKey, $PrincipalName)
$IPV4ScopesRuntime.AddProperty($ServerName, $PrincipalName)
$IPV4ScopesRuntime.AddProperty($ComponentName, $PrincipalName + "-IPv4 Scopes Runtime")
$IPV4ScopesRuntime.AddProperty($DisplayName, "IPv4 Scopes Runtime" + " (" + $PrincipalName + ")")
$discoveryData.AddInstance($IPV4ScopesRuntime)
}
}
catch [System.Exception]
{
$Description = $_.ToString()
Write-Warning "$Description"
}
finally
{
Write-Host "$SCRIPT_NAME - Discovery Data returned"
$discoveryData
}
</ScriptBody>
<Parameters>
<Parameter>
<Name>ElementID</Name>
<Value>$MPElement$</Value>
</Parameter>
<Parameter>
<Name>TargetID</Name>
<Value>$Target/Id$</Value>
</Parameter>
<Parameter>
<Name>PrincipalName</Name>
<Value>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>300</TimeoutSeconds>
</DataSource>
</Discovery>