Ta reguła odnajdywania umożliwia wypełnienie instalacji bazy danych usługi DHCP w wersji 2016 i 1709+.
Funkcja odnajdywania baz danych dla serwera DHCP w wersji 2016 i 1709+ pobiera obiekty baz danych DHCP 2016 i 1709+, powiązane właściwości i relację.
W razie potrzeby można przesłonić następujące parametry:
Interwał w sekundach: Liczba sekund dla każdego wykonania
Czas synchronizacji: Godzina, w formacie „gg:mm”, o której chcesz rozpocząć wykonanie.
Limit czasu w sekundach: Liczba sekund oczekiwania przed anulowaniem wykonywania „z powodu upłynięcia limitu czasu”.
Target | Microsoft.Windows.DHCPServer.10.0.Server |
Enabled | True |
Frequency | 86400 |
Remotable | False |
Discovered Classes and their attribuets: |
---|
|
ID | Module Type | TypeId | RunAs |
---|---|---|---|
DS | DataSource | Microsoft.Windows.TimedPowerShell.DiscoveryProvider | System.PrivilegedMonitoringAccount |
<Discovery ID="Microsoft.Windows.DHCPServer.10.0.Database.Discovery" Enabled="true" Target="Microsoft.Windows.DHCPServer.10.0.Server" ConfirmDelivery="true" Remotable="true" Priority="Normal">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="DHCP!Microsoft.Windows.DHCPServer.Library.Database">
<Property TypeID="System!System.Entity" PropertyID="DisplayName"/>
<Property TypeID="DHCP!Microsoft.Windows.DHCPServer.Library.Database" PropertyID="BackupInterval"/>
<Property TypeID="DHCP!Microsoft.Windows.DHCPServer.Library.Database" PropertyID="BackupPath"/>
<Property TypeID="DHCP!Microsoft.Windows.DHCPServer.Library.Database" PropertyID="CleanupInterval"/>
<Property TypeID="DHCP!Microsoft.Windows.DHCPServer.Library.Database" PropertyID="LoggingEnabled"/>
<Property TypeID="DHCP!Microsoft.Windows.DHCPServer.Library.Database" PropertyID="Path"/>
<Property TypeID="DHCP!Microsoft.Windows.DHCPServer.Library.Database" PropertyID="RestoreFlag"/>
<Property TypeID="DHCP!Microsoft.Windows.DHCPServer.Library.DHCPComponent" PropertyID="Name"/>
<Property TypeID="DHCP!Microsoft.Windows.DHCPServer.Library.Server" PropertyID="Name"/>
</DiscoveryClass>
</DiscoveryTypes>
<DataSource ID="DS" RunAs="System!System.PrivilegedMonitoringAccount" TypeID="Windows!Microsoft.Windows.TimedPowerShell.DiscoveryProvider">
<IntervalSeconds>86400</IntervalSeconds>
<SyncTime/>
<ScriptName>DiscoverDHCPDatabase.10.0.ps1</ScriptName>
<ScriptBody>
param ([String] $ElementID, [String] $TargetID, [String] $PrincipalName, [String] $NetbiosComputerName)
$SCRIPT_NAME = "DiscoverDHCPDatabase.10.0"
$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$"
$ServerName = "$MPElement[Name='DHCP!Microsoft.Windows.DHCPServer.Library.Server']/Name$"
$ComponentName = "$MPElement[Name='DHCP!Microsoft.Windows.DHCPServer.Library.DHCPComponent']/Name$"
$DHCPType = "$MPElement[Name='DHCP!Microsoft.Windows.DHCPServer.Library.Database']$"
$Name = "$MPElement[Name='DHCP!Microsoft.Windows.DHCPServer.Library.Server']/Name$"
$DisplayName = "$MPElement[Name='System!System.Entity']/DisplayName$"
$BackupInterval = "$MPElement[Name='DHCP!Microsoft.Windows.DHCPServer.Library.Database']/BackupInterval$"
$BackupPath = "$MPElement[Name='DHCP!Microsoft.Windows.DHCPServer.Library.Database']/BackupPath$"
$CleanupInterval = "$MPElement[Name='DHCP!Microsoft.Windows.DHCPServer.Library.Database']/CleanupInterval$"
$LoggingEnabled = "$MPElement[Name='DHCP!Microsoft.Windows.DHCPServer.Library.Database']/LoggingEnabled$"
$Path = "$MPElement[Name='DHCP!Microsoft.Windows.DHCPServer.Library.Database']/Path$"
$RestoreFlag = "$MPElement[Name='DHCP!Microsoft.Windows.DHCPServer.Library.Database']/RestoreFlag$"
Write-Host "$SCRIPT_NAME - Executing DHCP 2016 Database Discovery Powershell Script"
$discoveryData = $momAPI.CreateDiscoveryData(0, $ElementID, $TargetID)
$DHCPDB = Get-DhcpServerDatabase
if ($DHCPDB -eq $null)
{
Write-Host "$SCRIPT_NAME - No DHCP 2016 Database installed on the Server"
$discoveryData
exit
}
else
{
$targeDHCPDB = $discoveryData.CreateClassInstance($DHCPType)
$targeDHCPDB.AddProperty($ComputerKey, $PrincipalName)
$targeDHCPDB.AddProperty($ServerName, $PrincipalName)
$targeDHCPDB.AddProperty($ComponentName, $PrincipalName + "-DHCP 2016 Database")
$targeDHCPDB.AddProperty($DisplayName, $PrincipalName + "-DHCP 2016 Database")
$targeDHCPDB.AddProperty($BackupInterval, $DHCPDB.BackupInterval)
$targeDHCPDB.AddProperty($BackupPath, $DHCPDB.BackupPath)
$targeDHCPDB.AddProperty($CleanupInterval, $DHCPDB.CleanupInterval)
$targeDHCPDB.AddProperty($Path, $DHCPDB.FileName)
$targeDHCPDB.AddProperty($RestoreFlag, $DHCPDB.RestoreFromBackup)
$discoveryData.AddInstance($targeDHCPDB)
Write-Host "$SCRIPT_NAME - DHCP 2016 Database Added to Discovery data"
$discoveryData
Write-Host "$SCRIPT_NAME - Discovery data returned"
} </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>
<Parameter>
<Name>NetbiosComputerName</Name>
<Value>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetbiosComputerName$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>300</TimeoutSeconds>
</DataSource>
</Discovery>