Backup Exec Server auf Windows-Servern erkennen

Symantec_Backup_Exec_for_Windows_MPscom2007_DE.DiscoverServer (Discovery)

Erkennt Backup Exec Server.

Element properties:

TargetMicrosoft.Windows.Computer
EnabledTrue
Frequency900
RemotableFalse

Object Discovery Details:

Discovered Classes and their attribuets:
Discovered relationships and their attribuets:

Member Modules:

ID Module Type TypeId RunAs 
DS DataSource Microsoft.Windows.TimedScript.DiscoveryProvider Default

Source Code:

<Discovery ID="Symantec_Backup_Exec_for_Windows_MPscom2007_DE.DiscoverServer" Enabled="true" Target="Windows!Microsoft.Windows.Computer" ConfirmDelivery="false" Remotable="true" Priority="Normal">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="Symantec_Backup_Exec_for_Windows_MPscom2007_DE.Server">
<Property TypeID="Symantec_Backup_Exec_for_Windows_MPscom2007_DE.BaseClass" PropertyID="ServiceName"/>
<Property TypeID="Symantec_Backup_Exec_for_Windows_MPscom2007_DE.BaseClass" PropertyID="Version"/>
<Property TypeID="Symantec_Backup_Exec_for_Windows_MPscom2007_DE.BaseClass" PropertyID="Path"/>
<Property TypeID="Symantec_Backup_Exec_for_Windows_MPscom2007_DE.BaseClass" PropertyID="BuildMajor"/>
<Property TypeID="Symantec_Backup_Exec_for_Windows_MPscom2007_DE.BaseClass" PropertyID="BuildMinor"/>
<Property TypeID="Symantec_Backup_Exec_for_Windows_MPscom2007_DE.BaseClass" PropertyID="Version"/>
<Property TypeID="Symantec_Backup_Exec_for_Windows_MPscom2007_DE.BaseClass" PropertyID="ByteCode"/>
<Property TypeID="Symantec_Backup_Exec_for_Windows_MPscom2007_DE.BaseClass" PropertyID="IP"/>
<Property TypeID="Symantec_Backup_Exec_for_Windows_MPscom2007_DE.BaseClass" PropertyID="ComputerName"/>
<Property TypeID="System!System.Entity" PropertyID="DisplayName"/>
</DiscoveryClass>
<DiscoveryRelationship TypeID="Windows!Microsoft.Windows.ComputerHostsLocalApplication"/>
</DiscoveryTypes>
<DataSource ID="DS" TypeID="Windows!Microsoft.Windows.TimedScript.DiscoveryProvider">
<IntervalSeconds>900</IntervalSeconds>
<SyncTime/>
<ScriptName>Server_Discovery.vbs</ScriptName>
<Arguments>$MPElement$ $Target/Id$ $Target/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$ $Target/Property[Type="Windows!Microsoft.Windows.Computer"]/NetbiosComputerName$ $Target/Property[Type="Windows!Microsoft.Windows.Computer"]/IPAddress$</Arguments>
<ScriptBody><Script>' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

' Copyright Symantec Corporation 2012

' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
' Declare and Init some objects
Option Explicit

Dim oAPI, oDiscoveryData, oInst, oArgs, oReg ' Use global variables to speedup the script!
Dim SourceID, ManagedEntityId, TargetComputer, ComputerName, IP
Dim strComputer, ver, bytecode, BEwin, path, fullpath,release, major, minor
const HKEY_LOCAL_MACHINE = &amp;H80000002

strComputer = "localhost"
BEwin = "SOFTWARE\Symantec\Backup Exec For Windows\Backup Exec\"

Set oAPI = CreateObject("MOM.ScriptAPI")
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &amp; strComputer &amp; "\root\default:StdRegProv")


' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
' Check for the number of arguments
Set oArgs = WScript.Arguments
if oArgs.Count &lt; 5 Then
Call oAPI.LogScriptEvent("Server_Discovery.vbs",1010,1, "Insuficient number of parameters. Script was aborted.")
Wscript.Quit -1
End If

' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
' Load arguments
SourceId = oArgs(0)
ManagedEntityId = oArgs(1)
TargetComputer = oArgs(2)
ComputerName = oArgs(3)
IP = oArgs(4)

Call oAPI.LogScriptEvent("Server_Discovery.vbs",101,0, "Starting in computername:" &amp; ComputerName &amp;_
" TargetComputer:" &amp; TargetComputer &amp; " IP:" &amp; IP)

set oDiscoveryData = oAPI.CreateDiscoveryData(0, SourceId, ManagedEntityId)

' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
' Check for the existence of Backup Exec Server

If (RegistryKeyExists("SYSTEM\CurrentControlSet\Services\BackupExecRPCService\") = True) Then

' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
' Found it? Then instantiate and set properties of a new object.

ver = GetVer(BEwin)

' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
' Added to discover only Releases prior to 15.0. For support of 15.0 version changed this condition to next version.
' And add latest release view to SCOM pack.

if ver &lt; "15.0" and ver &gt;= "11.0" then

bytecode = GetSTR("HARDWARE\DESCRIPTION\System\CentralProcessor\0", "Identifier")
path = GetSTR(BEwin &amp; ver &amp; "\Install\", "Path")
fullpath = "\\" &amp; IP &amp; "\" &amp; replace( path, ":","$")
major = GetDW(BEwin &amp; ver &amp; "\Install\", "Build Major")
minor = GetDW(BEwin &amp; ver &amp; "\Install\", "Build Minor")

release = ""

if ver="14.0" then
ver = "2012"
end if

if ver="13.0" then
ver = "2010"
if major = 2896 then
release = ""
elseif major = 4164 then
release = " R2"
else
release = " R3"
end if
end if


if instr(bytecode, "64") &gt; 0 then
bytecode = "64 Bit"
else
bytecode = "32 Bit"
end if

set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Symantec_Backup_Exec_for_Windows_MPscom2007_DE.Server']$")
call oInst.AddProperty("$MPElement[Name='Symantec_Backup_Exec_for_Windows_MPscom2007_DE.BaseClass']/ComputerName$", ComputerName)
call oInst.AddProperty("$MPElement[Name='Symantec_Backup_Exec_for_Windows_MPscom2007_DE.BaseClass']/IP$", IP)
call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", TargetComputer)
call oInst.AddProperty("$MPElement[Name='Symantec_Backup_Exec_for_Windows_MPscom2007_DE.BaseClass']/ServiceName$", "BackupExecRPCService")
call oInst.AddProperty("$MPElement[Name='Symantec_Backup_Exec_for_Windows_MPscom2007_DE.BaseClass']/Version$", ver &amp; release )
call oInst.AddProperty("$MPElement[Name='Symantec_Backup_Exec_for_Windows_MPscom2007_DE.BaseClass']/BuildMajor$", major )
call oInst.AddProperty("$MPElement[Name='Symantec_Backup_Exec_for_Windows_MPscom2007_DE.BaseClass']/BuildMinor$", minor )
call oInst.AddProperty("$MPElement[Name='Symantec_Backup_Exec_for_Windows_MPscom2007_DE.BaseClass']/Path$", fullpath)
call oInst.AddProperty("$MPElement[Name='Symantec_Backup_Exec_for_Windows_MPscom2007_DE.BaseClass']/ByteCode$", bytecode)
call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "Symantec Backup Exec:Server " &amp; ver &amp; release &amp; " (" &amp; bytecode &amp; ")")
call oDiscoveryData.AddInstance(oInst)

End if ' End of version check.

End If

' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
' Return object to SCOM
Call oAPI.LogScriptEvent("Server_Discovery.vbs",101,0, "Execution complete.")
Call oAPI.Return(oDiscoveryData)

' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
' Deallocate the objects to avoid memory leak.
Set oAPI = Nothing
Set oDiscoveryData = Nothing
Set oInst = Nothing
Set oArgs = Nothing
Set oReg = Nothing


' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
' Helper functions:
' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
' RegistryKeyExists(strKey) --&gt; Returns True if strKey is present in the registry, otherwise False.
Function RegistryKeyExists(strKey)

Dim arrValueNames, arrValueTypes

' List all values inside the key. If key does not exist, then arrValueNames will continue a var, otherwise it will be an array
oReg.EnumValues HKEY_LOCAL_MACHINE, strKey, arrValueNames, arrValueTypes

' If it is an array, means that the key exists.
If isArray(arrValueNames) Then
RegistryKeyExists = True
Else
RegistryKeyExists = False
end if

End Function


' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
' GetVer(strKey) --&gt; Returns a string containing the version of Backup Exec installed in the system.
Function GetVer(strKey)

Dim strKeyPath, arrSubKeys, subkey

' Enumerate all subkeys under strKey.
oReg.EnumKey HKEY_LOCAL_MACHINE, strKey, arrSubKeys

GetVer = ""
For Each subkey In arrSubKeys
'Locate the version by returning the name of the first key that starts with 1.
'It is predicted that it will support all versions from 10.0 to 19.9 AS LONG AS there is no
'other key that starts with 1.
if left(subkey,1) = "1" Then
GetVer = subkey
Exit For
end if
Next

End Function


' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
' GetDW(strKey, strValue) --&gt; Returns a string containing the numerical value of the DWord.
Function GetDW(strKey, strValue)

Dim dwValue
oReg.GetDWORDValue HKEY_LOCAL_MACHINE, strKey, strValue, dwValue
GetDW = Cstr(dwValue)

End Function


' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
' GetSTR(strKey, strValue) --&gt; Returns the value of a string.
Function GetSTR(strKey, strValue)

Dim strRet
oReg.GetStringValue HKEY_LOCAL_MACHINE, strKey, strValue, strRet
GetSTR = strRet

End Function</Script></ScriptBody>
<TimeoutSeconds>300</TimeoutSeconds>
</DataSource>
</Discovery>