Servizio server: stato firewall

Microsoft.Windows.FileServices.Service.SMB.6.3.FirewallPortConfig (UnitMonitor)

Questo oggetto consente di monitorare le regole firewall in entrata per Condivisione file e stampanti e genera un avviso se le regole sono disabilitate o se le corrispondenti porte TCP sono bloccate.

Knowledge Base article:

Riepilogo

Questo oggetto consente di monitorare le regole firewall in entrata per Condivisione file e stampanti e genera un avviso se le regole sono disabilitate o se le corrispondenti porte TCP 445 e 139 sono bloccate.

Cause

Questo monitor può entrare in uno stato d'integrità Critico per i motivi seguenti:

Se lo stato d'integrità è sconosciuto, significa che il monitoraggio non è ancora iniziato per questo oggetto.

Soluzioni

Determinare se Windows Firewall è abilitato

Per determinare se Windows Firewall è abilitato, eseguire la procedura seguente:

1. In un prompt dei comandi con privilegi elevati nel server in questione digitare: sc query mpssvc e premere INVIO.

2. Se il firewall non è in esecuzione, digitare il comando seguente: net start mpssvc.

Determinare se le regole firewall per le porte sono abilitate

Per determinare se le regole firewall per le porte sono abilitate, eseguire la procedura seguente:

1. Aprire il Pannello di controllo nel server in questione e fare clic su Sistema e sicurezza, quindi fare clic su Windows Firewall.

2. Nel riquadro a sinistra fare clic su Impostazioni avanzate e quindi su Regole in entrata.

3. Controllare se le regole seguenti sono abilitate e se Azione è Consenti:

4. Se le regole firewall non sono abilitate, fare clic sulla regola e, nel menu Azione, fare clic su Abilita regola.

Quando il problema si risolve, nel monitor viene reimpostato automaticamente lo stato integro.

Element properties:

TargetMicrosoft.Windows.FileServices.Service.SMB.6.3
Parent MonitorSystem.Health.AvailabilityState
CategoryCustom
EnabledTrue
Alert GenerateTrue
Alert SeverityError
Alert PriorityNormal
Alert Auto ResolveTrue
Monitor TypeMicrosoft.Windows.TimedScript.TwoStateMonitorType
RemotableTrue
AccessibilityPublic
Alert Message
Servizio server: porte Condivisione file e stampanti bloccate
Windows Firewall è disabilitato o le regole firewall in entrata per le porte TCP 445 o 139 sono disabilitate.
RunAsMicrosoft.Windows.FileServices.MonitoringAccount

Source Code:

<UnitMonitor ID="Microsoft.Windows.FileServices.Service.SMB.6.3.FirewallPortConfig" Accessibility="Public" Enabled="true" Target="Microsoft.Windows.FileServices.Service.SMB.6.3" ParentMonitorID="SystemHealth!System.Health.AvailabilityState" Remotable="true" Priority="Normal" RunAs="FileServices!Microsoft.Windows.FileServices.MonitoringAccount" TypeID="Windows!Microsoft.Windows.TimedScript.TwoStateMonitorType" ConfirmDelivery="false">
<Category>Custom</Category>
<AlertSettings AlertMessage="Microsoft.Windows.FileServices.Service.SMB.6.3.FirewallPortConfig.AlertMessage">
<AlertOnState>Error</AlertOnState>
<AutoResolve>true</AutoResolve>
<AlertPriority>Normal</AlertPriority>
<AlertSeverity>Error</AlertSeverity>
</AlertSettings>
<OperationalStates>
<OperationalState ID="Error" MonitorTypeStateID="Error" HealthState="Error"/>
<OperationalState ID="Success" MonitorTypeStateID="Success" HealthState="Success"/>
</OperationalStates>
<Configuration>
<IntervalSeconds>30</IntervalSeconds>
<SyncTime/>
<ScriptName>CheckFirewallPort.vbs</ScriptName>
<Arguments>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Arguments>
<ScriptBody><Script>
Option Explicit

SetLocale("en-us")

Dim oArgs
Dim serverName

Set oArgs = WScript.Arguments
If oArgs.Count &lt; 1 Then
Wscript.Quit -1
Else
serverName = oArgs(0)
End If

' NET_FW_PROFILE_TYPE2
Const NET_FW_PROFILE2_DOMAIN = &amp;h0001
Const NET_FW_PROFILE2_PRIVATE = &amp;h0002
Const NET_FW_PROFILE2_PUBLIC = &amp;h0004
Const NET_FW_IP_PROTOCOL_TCP = &amp;h0006

' Create the FwPolicy2 object
Dim fwPolicy2
Set fwPolicy2 = CreateObject("HNetCfg.FwPolicy2")

Dim fwCurrentProfile, fwCheckProfile
fwCurrentProfile = fwPolicy2.CurrentProfileTypes
fwCheckProfile = fwCurrentProfile And (NET_FW_PROFILE2_DOMAIN Or NET_FW_PROFILE2_PRIVATE)

Dim fwFileSharingPortsEnabled
fwFileSharingPortsEnabled ="False"

Dim rule
For Each rule in fwPolicy2.Rules
If (rule.Protocol = NET_FW_IP_PROTOCOL_TCP) And (rule.LocalPorts = "445") Then
If (Not rule.Enabled) And (rule.Profiles And fwCheckProfile ) Then
fwFileSharingPortsEnabled = "True"
Exit For
End If
End If
Next

Dim regularShareExist, objWMIService, colShares, objShare
regularShareExist = "False"

Set objWMIService = GetObject("winmgmts:" _
&amp; "{impersonationLevel=impersonate}!\\" &amp; serverName &amp; "\root\microsoft\windows\smb")
Set colShares = objWMIService.ExecQuery("Select * from MSFT_SmbShare")
For each objShare in colShares
If objShare.Special = "False" Then
regularShareExist = "True"
Exit For
End If
Next

Dim portStatus
portStatus = "Disabled"

' Only if regular share exists and port 139/445 are not open will portStatus be returned as "Disabled"
If fwFileSharingPortsEnabled = "True" Then
portStatus = "Enabled"
Else
If regularShareExist = "False" Then
portStatus = "Enabled"
End If
End If

Dim oAPI, oBag

Set oAPI = CreateObject("MOM.ScriptAPI")
Set oBag = oAPI.CreatePropertyBag()

Call oBag.AddValue ("PortStatus", portStatus)
Call oAPI.Return(oBag)

</Script></ScriptBody>
<TimeoutSeconds>300</TimeoutSeconds>
<ErrorExpression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">Property[@Name='PortStatus']</XPathQuery>
</ValueExpression>
<Operator>NotEqual</Operator>
<ValueExpression>
<Value Type="String">Enabled</Value>
</ValueExpression>
</SimpleExpression>
</ErrorExpression>
<SuccessExpression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">Property[@Name='PortStatus']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">Enabled</Value>
</ValueExpression>
</SimpleExpression>
</SuccessExpression>
</Configuration>
</UnitMonitor>