Esta regra de deteção povoa as instâncias do Servidor do Cluster de DHCP 2012 R2.
A Deteção de Servidores do Servidor do Cluster de DHCP 2012 R2 obtém o objeto do Servidor do Cluster de DHCP 2012 R2, assim como as respetivas propriedades e relação.
Estes são os parâmetros que podemos substituir, se for necessário:
Segundos de Intervalo: quantidade de segundos para cada execução
Tempo de Sincronização: tempo expressado neste formato "hh:mm" desde o momento em que gostaria de iniciar a execução.
Limite de Tempo (Segundos): quantidade de segundos a aguardar até cancelar a execução por "motivos de limite de tempo".
Target | Microsoft.Windows.Cluster.VirtualServer |
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.2012.R2.ClusterServer.Discovery" Enabled="true" Target="Cluster!Microsoft.Windows.Cluster.VirtualServer" ConfirmDelivery="true" Remotable="true" Priority="Normal">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="Microsoft.Windows.DHCPServer.2012.R2.Server">
<Property TypeID="DHCP!Microsoft.Windows.DHCPServer.Library.Server" PropertyID="Name"/>
<Property TypeID="DHCP!Microsoft.Windows.DHCPServer.Library.Server" PropertyID="AdministrativeRights"/>
<Property TypeID="DHCP!Microsoft.Windows.DHCPServer.Library.Server" PropertyID="AuditDiskCheckInterval"/>
<Property TypeID="DHCP!Microsoft.Windows.DHCPServer.Library.Server" PropertyID="AuditMaxLogSize"/>
<Property TypeID="DHCP!Microsoft.Windows.DHCPServer.Library.Server" PropertyID="AuditMinDiskSpace"/>
<Property TypeID="DHCP!Microsoft.Windows.DHCPServer.Library.Server" PropertyID="BindingsAware"/>
<Property TypeID="DHCP!Microsoft.Windows.DHCPServer.Library.Server" PropertyID="BootPEnabled"/>
<Property TypeID="DHCP!Microsoft.Windows.DHCPServer.Library.Server" PropertyID="ConflictPingRetries"/>
<Property TypeID="DHCP!Microsoft.Windows.DHCPServer.Library.Server" PropertyID="ADIntegrated"/>
<Property TypeID="DHCP!Microsoft.Windows.DHCPServer.Library.Server" PropertyID="v4AuditEnabled"/>
<Property TypeID="DHCP!Microsoft.Windows.DHCPServer.Library.Server" PropertyID="v4AuditFilePath"/>
<Property TypeID="DHCP!Microsoft.Windows.DHCPServer.Library.Server" PropertyID="DNSDynamicUpdates"/>
<Property TypeID="DHCP!Microsoft.Windows.DHCPServer.Library.Server" PropertyID="OSCurrentVersion"/>
<Property TypeID="DHCP2012!Microsoft.Windows.DHCPServer.2012.Server" PropertyID="NAPDefaultFail"/>
<Property TypeID="DHCP2012!Microsoft.Windows.DHCPServer.2012.Server" PropertyID="NAPEnabled"/>
<Property TypeID="DHCP2012!Microsoft.Windows.DHCPServer.2012.Server" PropertyID="v6AuditEnabled"/>
<Property TypeID="DHCP2012!Microsoft.Windows.DHCPServer.2012.Server" PropertyID="v6AuditFilePath"/>
<Property TypeID="DHCP2012!Microsoft.Windows.DHCPServer.2012.Server" PropertyID="v6BindingIsEnabledArray"/>
<Property TypeID="DHCP2012!Microsoft.Windows.DHCPServer.2012.Server" PropertyID="v6PreferredIATALifetime"/>
<Property TypeID="DHCP2012!Microsoft.Windows.DHCPServer.2012.Server" PropertyID="v6PreferredLifetime"/>
<Property TypeID="DHCP2012!Microsoft.Windows.DHCPServer.2012.Server" PropertyID="v6RapidCommitFlag"/>
<Property TypeID="DHCP2012!Microsoft.Windows.DHCPServer.2012.Server" PropertyID="v6T1"/>
<Property TypeID="DHCP2012!Microsoft.Windows.DHCPServer.2012.Server" PropertyID="v6T2"/>
<Property TypeID="DHCP2012!Microsoft.Windows.DHCPServer.2012.Server" PropertyID="v6UnicastFlag"/>
<Property TypeID="DHCP2012!Microsoft.Windows.DHCPServer.2012.Server" PropertyID="v6ValidIATALifetime"/>
<Property TypeID="DHCP2012!Microsoft.Windows.DHCPServer.2012.Server" PropertyID="v6ValidLifetime"/>
</DiscoveryClass>
</DiscoveryTypes>
<DataSource ID="DS" RunAs="System!System.PrivilegedMonitoringAccount" TypeID="Windows!Microsoft.Windows.TimedPowerShell.DiscoveryProvider">
<IntervalSeconds>86400</IntervalSeconds>
<SyncTime/>
<ScriptName>DiscoverDHCPClusterServer2012R2</ScriptName>
<ScriptBody>
param ([String] $ElementID, [String] $TargetID, [String] $PrincipalName, [String] $NetbiosComputerName)
$SCRIPT_NAME = "DiscoverDHCPClusterServer2012R2"
$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
$TargetOSVersion = "6.3"
$ComputerKey = "$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$"
$DHCPType = "$MPElement[Name='Microsoft.Windows.DHCPServer.2012.R2.Server']$"
$Name = "$MPElement[Name='DHCP!Microsoft.Windows.DHCPServer.Library.Server']/Name$"
$DisplayName = "$MPElement[Name='System!System.Entity']/DisplayName$"
$ADIntegrated = "$MPElement[Name='DHCP!Microsoft.Windows.DHCPServer.Library.Server']/ADIntegrated$"
$BootPEnabled = "$MPElement[Name='DHCP!Microsoft.Windows.DHCPServer.Library.Server']/BootPEnabled$"
$BindingsAware = "$MPElement[Name='DHCP!Microsoft.Windows.DHCPServer.Library.Server']/BindingsAware$"
$AdmRights = "$MPElement[Name='DHCP!Microsoft.Windows.DHCPServer.Library.Server']/AdministrativeRights$"
$AuditDiskCheckInterval = "$MPElement[Name='DHCP!Microsoft.Windows.DHCPServer.Library.Server']/AuditDiskCheckInterval$"
$AuditMaxLogSize = "$MPElement[Name='DHCP!Microsoft.Windows.DHCPServer.Library.Server']/AuditMaxLogSize$"
$AuditMinDiskSpace = "$MPElement[Name='DHCP!Microsoft.Windows.DHCPServer.Library.Server']/AuditMinDiskSpace$"
$AuditEnabled = "$MPElement[Name='DHCP!Microsoft.Windows.DHCPServer.Library.Server']/v4AuditEnabled$"
$AuditFilePath = "$MPElement[Name='DHCP!Microsoft.Windows.DHCPServer.Library.Server']/v4AuditFilePath$"
$DNSDynamicUpdates = "$MPElement[Name='DHCP!Microsoft.Windows.DHCPServer.Library.Server']/DNSDynamicUpdates$"
$ConflictPingRetries = "$MPElement[Name='DHCP!Microsoft.Windows.DHCPServer.Library.Server']/ConflictPingRetries$"
$OSCurrentVersion = "$MPElement[Name='DHCP!Microsoft.Windows.DHCPServer.Library.Server']/OSCurrentVersion$"
$NAPEnabled = "$MPElement[Name='DHCP2012!Microsoft.Windows.DHCPServer.2012.Server']/NAPEnabled$"
$V6AuditEnabled = "$MPElement[Name='DHCP2012!Microsoft.Windows.DHCPServer.2012.Server']/v6AuditEnabled$"
$V6AuditFilePath = "$MPElement[Name='DHCP2012!Microsoft.Windows.DHCPServer.2012.Server']/v6AuditFilePath$"
$V6T1 = "$MPElement[Name='DHCP2012!Microsoft.Windows.DHCPServer.2012.Server']/v6T1$"
$V6T2 = "$MPElement[Name='DHCP2012!Microsoft.Windows.DHCPServer.2012.Server']/v6T2$"
$V6ValidLifeTime = "$MPElement[Name='DHCP2012!Microsoft.Windows.DHCPServer.2012.Server']/v6ValidLifetime$"
$V6ValidIATALifeTime = "$MPElement[Name='DHCP2012!Microsoft.Windows.DHCPServer.2012.Server']/v6ValidIATALifetime$"
$V6UnicastFlag = "$MPElement[Name='DHCP2012!Microsoft.Windows.DHCPServer.2012.Server']/v6UnicastFlag$"
$v6RapidCommitFlag = "$MPElement[Name='DHCP2012!Microsoft.Windows.DHCPServer.2012.Server']/v6RapidCommitFlag$"
$v6BindingIsEnabledArray = "$MPElement[Name='DHCP2012!Microsoft.Windows.DHCPServer.2012.Server']/v6BindingIsEnabledArray$"
Write-Host "$SCRIPT_NAME - Executing DHCP Cluster Server Discovery Powershell Script"
$discoveryData = $momAPI.CreateDiscoveryData(0, $ElementID, $TargetID)
$CurrOS = Get-WmiObject -Namespace "root\cimv2" -Query "select Version from Win32_OperatingSystem"
$OSVer = $CurrOS.Version
$CurrVer = $OSVer.Split(".")
$OS = $CurrVer.Item(0) + "." + $CurrVer.Item(1)
if ($OS -ne $TargetOSVersion)
{
Write-Host "$SCRIPT_NAME - No Target Operating System"
$discoveryData
exit
}
else
{
Write-Host "$SCRIPT_NAME - Target Server"
$DHCP = Get-WindowsFeature DHCP
$Cluster = Get-WindowsFeature Failover-Clustering
if ($DHCP.InstallState -eq $null)
{
Write-Host "$SCRIPT_NAME - No DHCP feature installed in the Server"
$discoveryData
exit
}
else
{
if ($DHCP.Installed -eq $true -and $Cluster.Installed -eq $true)
{
$targetServer = $discoveryData.CreateClassInstance($DHCPType)
$targetServer.AddProperty($ComputerKey, $PrincipalName)
$targetServer.AddProperty($Name, $PrincipalName)
$targetServer.AddProperty($DisplayName, $PrincipalName)
$DHCPServer = Get-DhcpServerSetting
$targetServer.AddProperty($ADIntegrated, $DHCPServer.IsDomainJoined)
$targetServer.AddProperty($BootPEnabled, $DHCPServer.DynamicBootp)
$targetServer.AddProperty($ConflictPingRetries, $DHCPServer.ConflictDetectionAttempts)
$targetServer.AddProperty($NAPEnabled, $DHCPServer.NAPEnabled)
$targetServer.AddProperty($OSCurrentVersion, $OSVer)
$DHCPv4 = Get-DhcpServerv4Binding
$DHCPv6 = Get-DhcpServerv6Binding
if ($DHCPv4 -ne $null)
{
if($DHCPv4.BindingState.Count -gt 1)
{
$BindingEnabled = $DHCPv4.BindingState.GetValue(1)
}
else
{
$BindingEnabled = $DHCPv4.BindingState
}
}
else
{
if ($DHCPv6 -ne $null)
{
if($DHCPv6.BindingState.Count -gt 1)
{
$BindingEnabled = $DHCPv6.BindingState.GetValue(1)
}
else
{
$BindingEnabled = $DHCPv6.BindingState
}
}
else
{
$BindingEnabled = $false
}
$targetServer.AddProperty($v6BindingIsEnabledArray, $BindingEnabled)
}
$targetServer.AddProperty($BindingsAware, $BindingEnabled)
$targetServer.AddProperty($AdmRights, $true)
$DHCPAudit = Get-DhcpServerAuditLog
$targetServer.AddProperty($AuditDiskCheckInterval, $DHCPAudit.DiskCheckInterval)
$targetServer.AddProperty($AuditMaxLogSize, $DHCPAudit.MaxMBFileSize)
$targetServer.AddProperty($AuditMinDiskSpace, $DHCPAudit.MinMBDiskSpace)
$targetServer.AddProperty($AuditEnabled, $DHCPAudit.Enable)
$targetServer.AddProperty($AuditFilePath, $DHCPAudit.Path)
$IPV4DNS = Get-DhcpServerv4DnsSetting
if ( $IPV4DNS.DynamicUpdates -eq "OnClientRequest")
{
$targetServer.AddProperty($DNSDynamicUpdates, 1)
}
else
{
$targetServer.AddProperty($DNSDynamicUpdates, 0)
}
$T6S = Get-DhcpServerv6Scope
if ($T6S.T1 -ne $null)
{
if($T6S.T1.TotalHours.Count -ge 1)
{
$TotHrs01 = $T6S.T1.TotalHours.Item(0).toString()
}
else
{
$TotHrs01 = $T6S.T1.TotalHours
}
$targetServer.AddProperty($V6T1, $TotHrs01)
}
if ($T6S.T2 -ne $null)
{
if($T6S.T2.TotalHours.Count -ge 1)
{
$TotHrs02 = $T6S.T2.TotalHours.Item(0).toString()
}
else
{
$TotHrs02 = $T6S.T2.TotalHours
}
$targetServer.AddProperty($V6T2, $TotHrs02)
}
$targetServer.AddProperty($V6AuditEnabled, $DHCPAudit.Enable)
$targetServer.AddProperty($V6AuditFilePath, $DHCPAudit.Path)
if ($T6S.ValidLifetime -ne $null)
{
if($T6S.ValidLifetime.Count -ge 1)
{
$TotHrs03 = $T6S.ValidLifetime.TotalHours.Item(0).toString()
}
else
{
$TotHrs03 = $T6S.ValidLifetime.TotalHours.Item(0).toString()
}
$targetServer.AddProperty($V6ValidLifeTime, $TotHrs03)
$targetServer.AddProperty($V6ValidIATALifeTime, $TotHrs03)
}
$targetServer.AddProperty($V6UnicastFlag, $false)
$targetServer.AddProperty($v6RapidCommitFlag, $false)
$discoveryData.AddInstance($targetServer)
$discoveryData
Write-Host "$SCRIPT_NAME - Discovery data returned"
}
else
{
Write-Host "$SCRIPT_NAME - No DHCP feature installed in the Server"
$discoveryData
exit
}
}
} </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/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Value>
</Parameter>
<Parameter>
<Name>NetbiosComputerName</Name>
<Value>$Target/Property[Type="Windows!Microsoft.Windows.Computer"]/NetbiosComputerName$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>300</TimeoutSeconds>
</DataSource>
</Discovery>