Windows Update 에이전트 프록시 구성 검색

Microsoft.SystemCenter.Essentials.WUAgent.ProxyConfigurationDetection (UnitMonitor)

자동 검색된 프록시 서버 때문에 Windows Update 에이전트에서 Essentials 서버에 연결할 수 없는지 여부를 확인합니다.

Knowledge Base article:

요약

프록시 구성 문제 때문에 Windows Update 에이전트에서 Essentials 서버와 통신할 수 없습니다.

원인

Windows Update 에이전트가 네트워크상의 프록시 서버를 자동으로 사용하고 있습니다. 이 프록시 서버는 Essentials 서버에 대한 FQDN 트래픽을 허용하도록 구성되지 않았습니다.

해결

Essentials 서버의 FQDN으로 전송되는 트래픽을 내부에서 다시 Essentials 서버로 라우팅하는 규칙 또는 구성을 프록시 서버에 추가합니다.

Element properties:

TargetMicrosoft.SystemCenter.Essentials.WUAgent
Parent MonitorSystem.Health.AvailabilityState
CategoryAvailabilityHealth
EnabledTrue
Alert GenerateFalse
Alert Auto ResolveTrue
Monitor TypeMicrosoft.Windows.TimedScript.TwoStateMonitorType
RemotableFalse
AccessibilityInternal
RunAsDefault

Source Code:

<UnitMonitor ID="Microsoft.SystemCenter.Essentials.WUAgent.ProxyConfigurationDetection" Accessibility="Internal" Enabled="onEssentialMonitoring" Target="Microsoft.SystemCenter.Essentials.WUAgent" ParentMonitorID="Health!System.Health.AvailabilityState" Remotable="false" Priority="Normal" TypeID="Windows!Microsoft.Windows.TimedScript.TwoStateMonitorType" ConfirmDelivery="false">
<Category>AvailabilityHealth</Category>
<OperationalStates>
<OperationalState ID="Success" MonitorTypeStateID="Success" HealthState="Success"/>
<OperationalState ID="Error" MonitorTypeStateID="Error" HealthState="Warning"/>
</OperationalStates>
<Configuration>
<IntervalSeconds>3600</IntervalSeconds>
<SyncTime/>
<ScriptName>ProxyConfigurationDetection.vbs</ScriptName>
<Arguments/>
<ScriptBody><Script>
'*************************************************************************
' Script Name - ProxyConfigurationDetection.vbs
'
' Purpose - Checks to see if WU Agent is not able to connect to Essentials Server
' due to Proxy issue
'
' Assumptions - Script is run as a runtime task
'
' Parameters - ManagementGroupName
'
' (c) Copyright 2006, Microsoft Corporation, All Rights Reserved
' Proprietary and confidential to Microsoft Corporation
'*************************************************************************

OPTION EXPLICIT
SetLocale("en-us")

Const SCRIPT_NAME = "ProxyConfigurationDetection"

Const EVENT_TYPE_WARNING = 2
Const EVENT_TYPE_INFORMATION = 4

Const EVENT_ID_SCRIPT_ERROR = 1000
Const EVENT_ID_SUCCESS = 99

Dim oAPI, objArgs, oBag
Dim objWebProxy, objSession, objUpdateSearcher, objSearchResults

'Create OpsMgr object
Set oAPI = CreateObject("Mom.ScriptAPI")

' Create a property bag
Set oBag= oAPI.CreatePropertyBag()

set objWebProxy = CreateObject("Microsoft.Update.WebProxy")

If IsNull(objwebProxy) OR IsEmpty(objwebProxy) Then
ScriptError "Unable to create Microsoft.Update.WebProxy object. " &amp; GetErrorString(Err)
Call oBag.AddValue("ProxyConfig", "Bad")
Call oAPI.Return(oBag)
Quit()
End If

Set objSession = CreateObject("Microsoft.Update.Session")

If IsNull(objSession) OR IsEmpty(objSession) Then
ScriptError "Unable to create Microsoft.Update.Session object. " &amp; GetErrorString(Err)
Call oBag.AddValue("ProxyConfig", "Bad")
Call oAPI.Return(oBag)
Quit()
End If

' Set the WebProxy of session
objSession.WebProxy = objWebProxy

' Create searcher object
set objUpdateSearcher = objSession.CreateUpdateSearcher()
'wscript.echo "Checking for connection..."

Err.Clear

On Error Resume Next

set objSearchResults = objUpdateSearcher.Search("IsInstalled = 0 and IsHidden = 0")

'wscript.echo Err.number

' HEX Error number 80244021 is Bad Gateway (HTTP 502 Error)
' http://technet.microsoft.com/en-us/library/cc720442(WS.10).aspx
If Hex(Err.number) = "80244021" Then
On Error Goto 0

' If there is bad gateway, set auto-detect to false and try again
objWebProxy.AutoDetect = false

Err.Clear
On Error Resume Next
set objSearchResults = objUpdateSearcher.Search("IsInstalled = 0 and IsHidden = 0")

' If it succeeds then we know that WUAgent is not able to connect because of proxy
If (Hex(Err.number) = 0) Then
'wscript.echo "BAD"
Call oBag.AddValue("ProxyConfig", "Bad")
Call oAPI.Return(oBag)
Quit()
End If
end if

'If the error is not bad gateway, then we are good
'wscript.echo "GOOD"
Call oBag.AddValue("ProxyConfig", "Good")
Call oAPI.Return(oBag)
Quit()

'******************************************************************************
Sub ScriptError(strError)
'
' Purpose: Records a script error.
'
' Parameters: strError, the description of the error to record
''******************************************************************************

CreateEvent EVENT_ID_SCRIPT_ERROR, EVENT_TYPE_WARNING, "The script '" &amp; SCRIPT_NAME &amp; "' failed while " &amp; strError
End Sub

'******************************************************************************
Function GetErrorString(oErr)
'
' 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.)
'******************************************************************************

Dim lErr, strErr
lErr = oErr
strErr = oErr.Description

On Error Resume Next
If 0 &gt;= 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 = &amp;HFFFF0000
Const HiWord8007 = &amp;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 " &amp; (lErr And LoWordMask))

Dim strMessage, i
Do
strMessage = oExec.stdout.ReadLine()
i = i + 1
Loop While (Len(strMessage) = 0) And (i &lt; 5)

strErr = strMessage
End If
End If
End If

GetErrorString = vbCrLf &amp; "The error returned was: '" &amp; strErr &amp; "' (0x" &amp; Hex(lErr) &amp; ")"
End Function

'******************************************************************************
Sub CreateEvent(lngEventID, lngEventType, strMessage)
'
' Purpose: To create a MOM event
'
' Arguments:lngEventID, the event ID
' lngEventType, the event type (see values at top of file)
' strMessage, the message text for the event
'******************************************************************************
oAPI.LogScriptEvent "ProxyConfigurationDetection", lngEventID, lngEventType, strMessage
End Sub

'*************************************************************************
Function Quit()

WScript.Quit()

End Function
'****************************************************************************
</Script></ScriptBody>
<SecureInput/>
<TimeoutSeconds>300</TimeoutSeconds>
<ErrorExpression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">Property[@Name='ProxyConfig']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">Bad</Value>
</ValueExpression>
</SimpleExpression>
</ErrorExpression>
<SuccessExpression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">Property[@Name='ProxyConfig']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">Good</Value>
</ValueExpression>
</SimpleExpression>
</SuccessExpression>
</Configuration>
</UnitMonitor>