Forefront サービスの検出

Forefront_Service_Discovery (WriteActionModuleType)

Forefront サービスの検出。

Element properties:

TypeWriteActionModuleType
IsolationAny
AccessibilityInternal
RunAsDefault
InputTypeSystem.BaseData
Comment{E8B8FAB8-4864-4332-81C0-44CD11DEC880}

Member Modules:

ID Module Type TypeId RunAs 
RunScriptAction WriteAction System.Mom.BackwardCompatibility.ScriptResponse Default

Source Code:

<WriteActionModuleType ID="Forefront_Service_Discovery" Comment="{E8B8FAB8-4864-4332-81C0-44CD11DEC880}" Accessibility="Internal" Batching="false">
<Configuration>
<IncludeSchemaTypes>
<SchemaType>MomBackwardCompatibility!System.Mom.BackwardCompatibility.AlertGenerationSchema</SchemaType>
</IncludeSchemaTypes>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="AlertGeneration" type="AlertGenerationType"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="InvokerType" type="xsd:integer"/>
</Configuration>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<WriteAction ID="RunScriptAction" TypeID="MomBackwardCompatibility!System.Mom.BackwardCompatibility.ScriptResponse">
<AlertGeneration>$Config/AlertGeneration$</AlertGeneration>
<InvokerType>$Config/InvokerType$</InvokerType>
<Body><Script>

const HKEY_LOCAL_MACHINE = &amp;H80000002
Dim m_strProduct

Sub Main()

Dim oDiscData
Dim oCollection
Dim oInstance
Dim WshShell
Dim strTempProductPath

Set oDiscData = ScriptContext.CreateDiscoveryData
Set oCollection = oDiscData.CreateCollection

'WriteLog "Microsoft Forefront Service Discovery started."
ScriptContext.Echo "[Trace]: Microsoft Forefront Service Discovery started."

With oCollection
.AddScopeFilter "ComputerName", ScriptContext.TargetComputerIdentity
.ClassID = "ForefrontServer"
.AddScopeComponent "services"
End With

Set oInstance = oCollection.CreateInstance

If ForefrontInstalled Then
With oInstance
.AddKeyProperty "Server Name", ScriptContext.TargetNetbiosComputer
.AddComponent "services"
End With
Else
ScriptContext.Echo "[Trace]: No Microsoft Forefront products found."
End If

oCollection.AddInstance oInstance
oDiscData.AddCollection oCollection

ScriptContext.Submit oDiscData

ScriptContext.Echo "[Trace]: Forefront Service Discovery script complete."

Set oDiscData = Nothing
Set oCollection = Nothing
Set oInstance = Nothing

End Sub


Function ForefrontInstalled()
Dim arrProducts(1)

arrProducts(0) = "Exchange Server"
arrProducts(1) = "SharePoint" ' Add Forefront for SharePoint support

bFound = false

arrSubKeys = EnumRegKeys("SOFTWARE\Microsoft\Forefront Server Security")
arrSubKeys64 = EnumRegKeys("SOFTWARE\Wow6432Node\Microsoft\Forefront Server Security")

If IsArray(arrSubKeys) Then
For Each product in arrProducts
For Each subkey In arrSubKeys
If subkey = product Then
bFound = true
m_strProduct = product
ScriptContext.Echo "[Trace]: " &amp; product &amp; " found."
End If
Next
Next
Else
ScriptContext.Echo "[Error]: Unable to enumerate HKLM\Software\Microsoft\Forefront Server Security."
End If

If IsArray(arrSubKeys64) Then
For Each product in arrProducts
For Each subkey In arrSubKeys64
If subkey = product Then
bFound = true
m_strProduct = product
ScriptContext.Echo "[Trace]: " &amp; product &amp; " found."
End If
Next
Next
Else
ScriptContext.Echo "[Error]: Unable to enumerate HKLM\Software\Wow6432Node\Microsoft\Forefront Server Security."
End If

ForefrontInstalled = bFound
End Function


Function EnumRegKeys(ByVal strKeyPath)
Dim arrKeys()

Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
lResult = objReg.EnumKey(HKEY_LOCAL_MACHINE, strKeyPath, arrKeys)

Set objReg = Nothing

EnumRegKeys = arrKeys
End Function
</Script></Body>
<Language>VBScript</Language>
<Name>Forefront Service Discovery</Name>
<Parameters/>
<ManagementPackId>[FSMPack2007_FSE,,1.0.0.1]</ManagementPackId>
</WriteAction>
</MemberModules>
<Composition>
<Node ID="RunScriptAction"/>
</Composition>
</Composite>
</ModuleImplementation>
<InputType>SystemLibrary!System.BaseData</InputType>
</WriteActionModuleType>