A pingelési kísérlet sikertelen ismétléseinek azon száma, amely már riasztást vált ki
TimeoutSeconds
int
$Config/TimeoutSeconds$
Időtúllépés hossza (s)
Source Code:
<DataSourceModuleType ID="Microsoft.Windows.AD.DomainMemberPerspective.Availability.PDC.Ping.DataSource" Accessibility="Internal">
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="IntervalSeconds" type="xsd:int"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="PingIterations" type="xsd:int"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="TimeoutSeconds" type="xsd:int"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="IntervalSeconds" ParameterType="int" Selector="$Config/IntervalSeconds$"/>
<OverrideableParameter ID="PingIterations" ParameterType="int" Selector="$Config/PingIterations$"/>
<OverrideableParameter ID="TimeoutSeconds" ParameterType="int" Selector="$Config/TimeoutSeconds$"/>
</OverrideableParameters>
<ModuleImplementation>
<Composite>
<MemberModules>
<DataSource ID="DS" TypeID="System!System.CommandExecuterPropertyBagSource">
<IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
<ApplicationName>%windir%\system32\cscript.exe</ApplicationName>
<WorkingDirectory/>
<CommandLine>//nologo $file/PDC_Ping_Availability.vbs$ $Config/PingIterations$</CommandLine>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
<RequireOutput>true</RequireOutput>
<Files>
<File>
<Name>PDC_Ping_Availability.vbs</Name>
<Contents><Script>'*************************************************************************
' Script Name - PDC Ping Availability
'
' Purpose - Monitors that pings to the PDC holder respond
'
' (c) Copyright 2014, Microsoft Corporation, All Rights Reserved
' Proprietary and confidential to Microsoft Corporation
'*************************************************************************
Option Explicit
SetLocale("en-us")
Sub Main()
Dim oAPI, oBag, oParams, sError, oRootDSE, oDomain, oFsmo
Dim oPing, oStatus, oNtds, oFsmoHolder, iIteration, iMaxIterations
Set oAPI = CreateObject("Mom.ScriptAPI")
Set oBag = oAPI.CreatePropertyBag()
Set oParams = WScript.Arguments
if oParams.Count <> 1 then
sError = "The number of command line arguments is incorrect: " & vbCrLf & _
"Expected: 1" & vbCrLf & _
"Actual: " & oParams.Count
if iMaxIterations < 1 then
iMaxIterations = 3
End if
On Error Resume Next
Set oRootDSE = GetObject("LDAP://rootDSE")
If (Err.Number <> 0) Then
oBag.AddValue "State", "BAD"
oBag.AddValue "ErrorString", "Unable to bind to the rootDSE." & GetErrorString(Err)
oAPI.AddItem oBag
Call oAPI.Return(oBag)
Exit Sub
End if
Set oDomain = GetObject ("LDAP://" & oRootDSE.Get("defaultNamingContext"))
If (Err.Number <> 0) Then
oBag.AddValue "State", "BAD"
oBag.AddValue "ErrorString", "Unable to get the defaultNamingContext naming context." & GetErrorString(Err)
oAPI.AddItem oBag
Call oAPI.Return(oBag)
Exit Sub
End if
oFsmo = oDomain.Get("fSMORoleOwner")
If (Err.Number <> 0) Then
oBag.AddValue "State", "BAD"
oBag.AddValue "ErrorString", "Unable to get the fSMORoleOwner property." & GetErrorString(Err)
oAPI.AddItem oBag
Call oAPI.Return(oBag)
Exit Sub
End if
Set oNtds = GetObject("LDAP://" & oFsmo)
If (Err.Number <> 0) Then
oBag.AddValue "State", "BAD"
oBag.AddValue "ErrorString", "Unable to connect to the FSMO owner " & oFsmo & "." & GetErrorString(Err)
oAPI.AddItem oBag
Call oAPI.Return(oBag)
Exit Sub
End if
Set oFsmoHolder = GetObject(oNtds.Parent)
For iIteration = 0 to iMaxIterations
Set oPing = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery("select * from Win32_PingStatus where address = '" & oFsmoHolder.dnsHostName & "'")
For Each oStatus in oPing
If not IsNull(oStatus.StatusCode) and oStatus.StatusCode = 0 Then
oBag.AddValue "State", "GOOD"
oAPI.AddItem oBag
Call oAPI.Return(oBag)
Exit Sub
End If
Next
Next
oBag.AddValue "State", "BAD"
oBag.AddValue "ErrorString", "Unable to ping the FSMO holder " & oFsmoHolder.dnsHostName
oAPI.AddItem oBag
oAPI.ReturnItems
End Sub
'******************************************************************************
' Name: GetErrorString
'
' Purpose: Attempts to find the description for an error if an error with
' no description is passed in.
'
' Parameters: oErr, the error object
'
' Return: String, the description for the error. (Includes the error code.)
'
Function GetErrorString(oErr)
Dim lErr, strErr
lErr = oErr
strErr = oErr.Description
On Error Resume Next
If 0 >= Len(strErr) Then
' If we don't have an error description, then check to see if the error
' is a 0x8007xxxx error. If it is, then look it up.
Const ErrorMask = &HFFFF0000
Const HiWord8007 = &H80070000
Const LoWordMask = 65535 ' This is equivalent to 0x0000FFFF
If (lErr And ErrorMask) = HiWord8007 Then
' Attempt to use 'net helpmsg' to get a description for the error.
Dim oShell
Set oShell = CreateObject("WScript.Shell")
If Err = 0 Then
Dim oExec
Set oExec = oShell.Exec("net helpmsg " & (lErr And LoWordMask))
Dim strMessage, i
Do
strMessage = oExec.stdout.ReadLine()
i = i + 1
Loop While (Len(strMessage) = 0) And (i < 5)
strErr = strMessage
End If
End If
End If
GetErrorString = vbCrLf & vbCrLf & "The error returned was: '" & strErr & "' (0x" & Hex(lErr) & ")"
End Function