AD-klientövervakning och dess identifiering

Microsoft.AD.ClientPerspective.Discovery (Discovery)

Identifieringsregel för att aktivera AD-klientövervakning Som standard är den här regeln inaktiverad. Använd Åsidosätt för att aktivera ett AD-klientövervakningssystem som önskas

Knowledge Base article:

Sammanfattning

AD-klientens perspektividentifieringsregel Denna regel aktiverar AD-klientövervakningen från en Windows datorsystem (medlemsserver eller klient på stationär dator). Typiska är att Windows serversystem som har specifika AD-tillgänglighetskrav är AD-klient övervakningskandidater för Exchange server-system.

Konfiguration

Identifieringsregeln är inaktiverad som standard och måste aktiveras manuellt i det valda Windows-systemet.

VARNING: Aktivera inte denna regel globalt i alla Windows-system i din miljö, eftersom detta skulle kunna påverka tillgängligheten av dina domänkontrollanter. Utför endast selektiv aktivera på individuella noder eller i anpassade grupper.

Element properties:

TargetMicrosoft.Windows.Computer
EnabledFalse
Frequency14400
RemotableFalse

Object Discovery Details:

Discovered Classes and their attribuets:

Member Modules:

ID Module Type TypeId RunAs 
DiscoveryDataSource DataSource System.CommandExecuterDiscoveryDataSource Default

Source Code:

<Discovery ID="Microsoft.AD.ClientPerspective.Discovery" Enabled="false" Remotable="false" Target="Windows!Microsoft.Windows.Computer">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="AD!Microsoft.Windows.Server.AD.ClientPerspective"/>
</DiscoveryTypes>
<DataSource ID="DiscoveryDataSource" TypeID="System!System.CommandExecuterDiscoveryDataSource">
<IntervalSeconds>14400</IntervalSeconds>
<ApplicationName>%windir%\System32\cscript.exe</ApplicationName>
<WorkingDirectory/>
<CommandLine>$file/ADClientPerspective.vbs$ 0 $MPElement$ $Target/Id$ $Target/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</CommandLine>
<TimeoutSeconds>120</TimeoutSeconds>
<RequireOutput>true</RequireOutput>
<Files>
<File>
<Name>ADClientPerspective.vbs</Name>
<Contents><Script>
'*************************************************************************
' Script Name - AD ClientPerspective Discovery
'
' Purpose - Discovers a ClientPerspective
'
' (c) Copyright 2003, Microsoft Corporation, All Rights Reserved
' Proprietary and confidential to Microsoft Corporation
'*************************************************************************

Sub Main()
'Variables
Dim oArgs,SourceType,SourceID,ManagedEntityId,TargetPricipalName
Set oArgs = WScript.Arguments
if oArgs.Count &lt; 4 Then
Wscript.Quit -1
End If

SourceType = oArgs(0)
SourceID = oArgs(1)
ManagedEntityId = oArgs(2)
TargetPricipalName = oArgs(3)

' Install the OOMADs Helper Objects
InstallOOMADs()

Dim oAPI,oDiscData
Set oAPI = CreateObject("Mom.ScriptAPI")
Set oDiscData = oAPI.CreateDiscoveryData (SourceType, SourceID, ManagedEntityId)

Dim oClientPerspectiveInstance
Set oClientPerspectiveInstance = oDiscData.CreateClassInstance("$MPElement[Name='AD!Microsoft.Windows.Server.AD.ClientPerspective']$")
oClientPerspectiveInstance.AddProperty "$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", TargetPricipalName
oClientPerspectiveInstance.AddProperty "$MPElement[Name="System!System.Entity"]/DisplayName$", "AD Client Monitoring"

oDiscData.AddInstance(oClientPerspectiveInstance)
oAPI.Return oDiscData
End Sub


'******************************************************************************
'
' Purpose: Installs the OOMADs Helper Objects
'
' Parameters: None
'
'
Function InstallOOMADs()

Dim state
Dim installer
Dim propertyValues
Dim productGuid
Dim msiPath
Dim wshShell
Dim installDirectory
Dim msiInstallStateDefault
Dim fso
Dim path
Dim database
Dim view
Dim record
Dim installedProductVersion, productVersion
Dim systemDrive
Dim wshEnv
Dim scriptAPI

Const EVENT_ID_INSTALL_OOMADS_FAILURE = 10
Const EventSeverityWarning = 2
const EventSource = "AD ClientPerspective Discovery"

On Error Resume Next

Set scriptAPI = CreateObject("Mom.ScriptAPI")

'msiInstallStateDefault indicates that the product is installed the current user
msiInstallStateDefault = 5

productGuid = "{AA00C97B-5847-4948-824C-FC4C080B5410}"

set installer = CreateObject("WindowsInstaller.Installer")

state = installer.ProductState(productGuid)

If state = msiInstallStateDefault Then
On Error Resume Next
'check for the oomads.dll file in the correct directory
Set wshShell = CreateObject("WScript.Shell")

Set wshEnv = wshShell.Environment("PROCESS")
systemDrive = wshEnv("SYSTEMDRIVE")

if err.number = 0 Then
path = systemDrive &amp; "\Program Files (x86)\Common Files\Active Directory Management Pack Objects\oomads.dll"
Set fso = CreateObject("Scripting.FileSystemObject")

If (fso.FileExists(path)) Then
' If file is present, then log error and exit function
scriptAPI.LogScriptEvent EventSource, EVENT_ID_INSTALL_OOMADS_FAILURE, EventSeverityWarning, "This upgrade is not supported. Can not install OOMADS 64 bit version as there is already a 32 bit version of OOMADS installed"
Exit Function
End If
Err.Clear
End If
End If

' Check whether we need to install AD Helper Objects

Set wshShell = CreateObject("WScript.Shell")
installDirectory = wshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Operations Manager\3.0\Setup\InstallDirectory")

msiPath = installDirectory &amp; "HelperObjects\OOMADs.msi"

' Check if the msi exists
Set fso = CreateObject("Scripting.FileSystemObject")

If (fso.FileExists(msiPath)) Then

' fetch product guid from MSI
set database = installer.OpenDatabase(msiPath,0)
set view = database.OpenView ("SELECT `Value` FROM `Property` WHERE `Property`.`Property` = 'ProductCode' ")
view.Execute
set record = view.Fetch
productGuid = record.StringData (1)
state = installer.ProductState(productGuid)

' Check whether the product has been installed
If state = msiInstallStateDefault Then

installedProductVersion = installer.ProductInfo(productGuid, "VersionString")

' Get the version of the MSI on disk
set view = database.OpenView ("SELECT `Value` FROM `Property` WHERE `Property`.`Property` = 'ProductVersion' ")
view.Execute
set record = view.Fetch
productVersion = record.StringData (1)

If installedProductVersion = productVersion Then
' Installed product version is the same as the product version on disk - no need to install
Exit Function
End If

End If

' Install OOMADs
propertyValues = "ALLUSERS=1"
installer.UILevel = 2
installer.InstallProduct msiPath, propertyValues

state = installer.ProductState(productGuid)

' Check whether the installation was successful
If state &lt;&gt; msiInstallStateDefault Then
scriptAPI.LogScriptEvent EventSource, EVENT_ID_INSTALL_OOMADS_FAILURE, EventSeverityWarning, "Active Directory Helper Objects installation failed"
End if
Else
scriptAPI.LogScriptEvent EventSource, EVENT_ID_INSTALL_OOMADS_FAILURE, EventSeverityWarning, "Active Directory Helper Objects Installation unsuccessful. MSI was not found at the specified location"
End If
End Function

Call Main()
</Script></Contents>
</File>
</Files>
</DataSource>
</Discovery>