DHCP Server 2012 Ayrı Kapsamları Araştırma Modülü
Bu araştırma modülü, DHCP özelliği etkin olan Windows Server 2012'de verilen disk belleği parametrelerini kullanarak Kapsamları keşfeder.
Zaman Aşımı (Saniye): Modülün yürütmeyi tamamlaması için beklenecek süre (saniye).
İlk Satır: Modülün yürütmeyi tamamlaması için beklenecek süre (saniye).
Son Satır: Modülün yürütmeyi tamamlaması için beklenecek süre (saniye).
Type | ProbeActionModuleType |
Isolation | Any |
Accessibility | Public |
RunAs | Default |
OutputType | System.PropertyBagData |
ID | Module Type | TypeId | RunAs |
---|---|---|---|
Probe | ProbeAction | Microsoft.Windows.PowerShellPropertyBagTriggerOnlyProbe | Default |
ID | ParameterType | Selector | Display Name | Description |
---|---|---|---|---|
TimeoutSeconds | int | $Config/TimeoutSeconds$ | Zaman Aşımı (saniye) | Modülün yürütmeyi tamamlamak için bekleyeceği beklenen süre (saniye). |
InitialRow | int | $Config/InitialRow$ | İlk Satır | Keşifte döndürülecek ilk satırdır. |
FinalRow | int | $Config/FinalRow$ | Son Satır | Keşifte döndürülecek son satırdır. |
<ProbeActionModuleType ID="Microsoft.Windows.DHCPServer.2012.GetIndScopeStats" Accessibility="Public" Batching="false" PassThrough="false">
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="ComputerName" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="TimeoutSeconds" type="xsd:integer"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="InitialRow" type="xsd:integer"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="FinalRow" type="xsd:integer"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int"/>
<OverrideableParameter ID="InitialRow" Selector="$Config/InitialRow$" ParameterType="int"/>
<OverrideableParameter ID="FinalRow" Selector="$Config/FinalRow$" ParameterType="int"/>
</OverrideableParameters>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<ProbeAction ID="Probe" TypeID="Windows!Microsoft.Windows.PowerShellPropertyBagTriggerOnlyProbe">
<ScriptName>DHCP2012IndividualScopesProbe.ps1</ScriptName>
<ScriptBody>
param ([String] $PrincipalName, [Int] $InitialRow, [Int] $FinalRow)
$SCRIPT_NAME = "DHCP2012IndividualScopesProbe"
$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
Write-Host "$SCRIPT_NAME - Executing DHCP Scope 2012 Probe Powershell Script"
try
{
$IPV4Scopes = Get-DhcpServerv4ScopeStatistics
$IPV6Scopes = Get-DhcpServerv6ScopeStatistics
if($IPV4Scopes -eq $null)
{
$IPV4ScopesCount = 0
}
else
{
if($IPV4Scopes.Count -eq $null)
{
$IPV4ScopesCount = 1
}
else
{
$IPV4ScopesCount = $IPV4Scopes.Count
}
}
if($IPV6Scopes -eq $null)
{
$IPV6ScopesCount = 0
}
else
{
if($IPV6Scopes.Count -eq $null)
{
$IPV6ScopesCount = 1
}
else
{
$IPV6ScopesCount = $IPV6Scopes.Count
}
}
$IPV4Initial = if($InitialRow -eq 0){1}else{$InitialRow}
$IPV4Count = if($FinalRow -eq 0){$IPV4ScopesCount}else{$FinalRow}
for ($itmIPV4Scope=$IPV4Initial; $itmIPV4Scope -le $IPV4Count; $itmIPV4Scope++)
{
if($itmIPV4Scope -ge $IPV4Initial -and $itmIPV4Scope -le $IPV4Count)
{
if($IPV4ScopesCount -eq 1)
{
$ObjIPV4Scope = $IPV4Scopes
}
else
{
if($IPV4Scopes.Get($itmIPV4Scope-1) -ne $null)
{
$ObjIPV4Scope = $IPV4Scopes.Get($itmIPV4Scope-1)
}
}
$PercIPV4InUse = $ObjIPV4Scope.PercentageInUse
$PercIPV4Avail = 100-$PercIPV4InUse
[system.double] $DbldIPV4InUse = [System.Convert]::ToDouble($ObjIPV4Scope.InUse)
[system.double] $DbldIPV4InFree = [System.Convert]::ToDouble($ObjIPV4Scope.Free)
[System.String] $CounterIPV4AddInUse = "IPV4Scope-AddressesInUse"
[System.String] $CounterIPV4AddFree = "IPV4Scope-AddressesAvailable"
[System.String] $CounterIPV4PrcInUse = "IPV4Scope-PercentageInUse"
[System.String] $CounterIPV4PrcFree = "IPV4Scope-PercentageAvailable"
$PerformancePropertyBag = $momAPI.CreatePropertyBag()
$PerformancePropertyBag.AddValue("PerfCounter", $CounterIPV4AddInUse)
$PerformancePropertyBag.AddValue("PerfInstance", $ObjIPV4Scope.ScopeId.toString())
$PerformancePropertyBag.AddValue("PerfValue", $ObjIPV4Scope.InUse)
$PerformancePropertyBag
$PerformancePropertyBag = $momAPI.CreatePropertyBag()
$PerformancePropertyBag.AddValue("PerfCounter", $CounterIPV4AddFree)
$PerformancePropertyBag.AddValue("PerfInstance", $ObjIPV4Scope.ScopeId.toString())
$PerformancePropertyBag.AddValue("PerfValue", $ObjIPV4Scope.Free)
$PerformancePropertyBag
$PerformancePropertyBag = $momAPI.CreatePropertyBag()
$PerformancePropertyBag.AddValue("PerfCounter", $CounterIPV4PrcInUse)
$PerformancePropertyBag.AddValue("PerfInstance", $ObjIPV4Scope.ScopeId.toString())
$PerformancePropertyBag.AddValue("PerfValue", $PercIPV4InUse)
$PerformancePropertyBag
$PerformancePropertyBag = $momAPI.CreatePropertyBag()
$PerformancePropertyBag.AddValue("PerfCounter", $CounterIPV4PrcFree)
$PerformancePropertyBag.AddValue("PerfInstance", $ObjIPV4Scope.ScopeId.toString())
$PerformancePropertyBag.AddValue("PerfValue", $PercIPV4Avail)
$PerformancePropertyBag
Write-Host "$SCRIPT_NAME - IPV4 Performance Data Added"
}
}
$IPV6Initial = if($InitialRow -eq 0){1}else{$InitialRow}
$IPV6Count = if($FinalRow -eq 0){$IPV6ScopesCount}else{$FinalRow}
for ($itmIPV6Scope=$IPV6Initial; $itmIPV6Scope -le $IPV6Count; $itmIPV6Scope++)
{
if($itmIPV6Scope -ge $IPV6Initial -and $itmIPV6Scope -le $IPV6Count)
{
if($IPV6ScopesCount -eq 1)
{
$ObjIPV6Scope = $IPV6Scopes
}
else
{
if($IPV6Scopes.Get($itmIPV6Scope-1) -ne $null)
{
$ObjIPV6Scope = $IPV6Scopes.Get($itmIPV6Scope-1)
}
}
$PercIPV6InUse = $ObjIPV6Scope.PercentageInUse
$PercIPV6Avail = 100-$PercIPV6InUse
$ScaledIPV6InUse = $ObjIPV6Scope.InUse/1000000000
$ScaledIPV6Free = $ObjIPV6Scope.Free/1000000000
[system.double] $DbldIPV6InUse = [System.Convert]::ToDouble($ScaledIPV6InUse)
[system.double] $DbldIPV6Free = [System.Convert]::ToDouble($ScaledIPV6Free)
$DbldIPV6InUse = [System.Math]::Round($DbldIPV6InUse, 0)
$DbldIPV6Free = [System.Math]::Round($DbldIPV6Free, 0)
[System.String] $CounterIPV6AddInUse = "IPV6Scope-AddressesInUse-ScaledByBillion"
[System.String] $CounterIPV6AddFree = "IPV6Scope-AddressesAvailable-ScaledByBillion"
[System.String] $CounterIPV6PrcInUse = "IPV6Scope-PercentageInUse"
[System.String] $CounterIPV6PrcFree = "IPV6Scope-PercentageAvailable"
$PerformancePropertyBag = $momAPI.CreatePropertyBag()
$PerformancePropertyBag.AddValue("PerfCounter", $CounterIPV6AddInUse)
$PerformancePropertyBag.AddValue("PerfInstance", $ObjIPV6Scope.Prefix.toString())
$PerformancePropertyBag.AddValue("PerfValue", $DbldIPV6InUse)
$PerformancePropertyBag
$PerformancePropertyBag = $momAPI.CreatePropertyBag()
$PerformancePropertyBag.AddValue("PerfCounter", $CounterIPV6AddFree)
$PerformancePropertyBag.AddValue("PerfInstance", $ObjIPV6Scope.Prefix.toString())
$PerformancePropertyBag.AddValue("PerfValue", $DbldIPV6Free)
$PerformancePropertyBag
$PerformancePropertyBag = $momAPI.CreatePropertyBag()
$PerformancePropertyBag.AddValue("PerfCounter", $CounterIPV6PrcInUse)
$PerformancePropertyBag.AddValue("PerfInstance", $ObjIPV6Scope.Prefix.toString())
$PerformancePropertyBag.AddValue("PerfValue", $PercIPV6InUse)
$PerformancePropertyBag
$PerformancePropertyBag = $momAPI.CreatePropertyBag()
$PerformancePropertyBag.AddValue("PerfCounter", $CounterIPV6PrcFree)
$PerformancePropertyBag.AddValue("PerfInstance", $ObjIPV6Scope.Prefix.toString())
$PerformancePropertyBag.AddValue("PerfValue", $PercIPV6Avail)
$PerformancePropertyBag
Write-Host "$SCRIPT_NAME - IPV6 Performance Data Added"
}
}
}
catch [System.Exception]
{
$Description = $_.ToString()
Write-Warning "$SCRIPT_NAME - $Description"
$PerformancePropertyBag = $momAPI.CreatePropertyBag()
$PerformancePropertyBag.AddValue("IPV4Scope-AddressesInUse", 0)
$PerformancePropertyBag.AddValue("IPV4Scope-AddressesAvailable", 0)
$PerformancePropertyBag.AddValue("IPV4Scope-PercentageInUse", 0)
$PerformancePropertyBag.AddValue("IPV4Scope-PercentageAvailable", 0)
$PerformancePropertyBag.AddValue("IPV6Scope-AddressesInUse-ScaledByBillion", 0)
$PerformancePropertyBag.AddValue("IPV6Scope-AddressesAvailable-ScaledByBillion", 0)
$PerformancePropertyBag.AddValue("IPV6Scope-PercentageInUse", 0)
$PerformancePropertyBag.AddValue("IPV6Scope-PercentageAvailable", 0)
$PerformancePropertyBag
}
finally
{
Write-Host "$SCRIPT_NAME - multiple performance property bag returned"
}
</ScriptBody>
<Parameters>
<Parameter>
<Name>PrincipalName</Name>
<Value>$Config/ComputerName$</Value>
</Parameter>
<Parameter>
<Name>InitialRow</Name>
<Value>$Config/InitialRow$</Value>
</Parameter>
<Parameter>
<Name>FinalRow</Name>
<Value>$Config/FinalRow$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
</ProbeAction>
</MemberModules>
<Composition>
<Node ID="Probe"/>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.PropertyBagData</OutputType>
<TriggerOnly>true</TriggerOnly>
</ProbeActionModuleType>