Management Server Group data discovery

Intel.Hardware.ModularServer.ServerGroupConfigurationDiscovery (Discovery)

Element properties:

TargetMicrosoft.SystemCenter.ManagementServer
EnabledTrue
Frequency180
RemotableFalse

Object Discovery Details:

Discovered Classes and their attribuets:

Member Modules:

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

Source Code:

<Discovery ID="Intel.Hardware.ModularServer.ServerGroupConfigurationDiscovery" Target="SC!Microsoft.SystemCenter.ManagementServer" Remotable="true" Enabled="true" ConfirmDelivery="false" Priority="High">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="Intel.Hardware.ModularServer.GroupConfiguration"/>
</DiscoveryTypes>
<DataSource ID="DS" TypeID="Windows!Microsoft.Windows.TimedScript.DiscoveryProvider">
<IntervalSeconds>180</IntervalSeconds>
<SyncTime/>
<ScriptName>CreateMultiFlexGroupConfig.vbs</ScriptName>
<Arguments>$MPElement$ $Target/Id$ $Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/DNSName$</Arguments>
<ScriptBody><Script>
' CreateMultiFlexGroupConfig.vbs
' Arguments :
' SourceID : UUID like "{63167791-E589-9632-501C-B83D73EFD8EE}"
' ManagedID : UUID like "{63167791-E589-9632-501C-B83D73EFD8EE}"
' MgmtServerAddress : Management Server Address
'
' This script creates an object Intel.Hardware.GroupConfiguration and
' populate it with SCE Server Address. This address is used by console
' tasks to find out the Server.
'

Option Explicit

'Define all the constants
const cEventID=1001
const cInfo=4 'For logging informational log Events
const cWarning=2 'For Logging warning Events
const cError=1 'For Logging Error Events
const cEventLogFileName="CreateMultiFlexGroupConfig"

Dim oArgs
Dim oAPI
Dim oDiscoveryData
Dim oInst

call Main
' End of GlobalPath

'start of Main subroutine
Sub Main()
Dim ErrMsg

On Error Resume Next

Set oAPI = CreateObject("MOM.ScriptAPI")
If Err.Number &lt;&gt; 0 Then
ErrMsg = "Object Creation MOM.ScriptAPI failed" &amp; vbCrLf _
&amp; "The Error : " &amp; Err.Description &amp; vbCrLf &amp; "was generated in " &amp; Err.Source
Err.Clear
Call oAPI.LogScriptEvent(cEventLogFileName,cEventID, cError, ErrMsg)
Exit Sub
End If

Set oArgs = WScript.Arguments
if oArgs.Count &lt;&gt; 3 Then
Call oAPI.LogScriptEvent(cEventLogFileName,cEventID, cError, _
"Insufficient Arguments in " &amp; cEventLogFileName)
Wscript.Quit -1
End If

Dim sSourceID, sManagedEntityId, sManagementServer
' sSourceID = "{63167791-E589-9632-501C-B83D73EFD8EE}"
' sManagedEntityId = "{63167791-E589-9632-501C-B83D73EFD8EE}"
sSourceID = oArgs(0)
sManagedEntityId = oArgs(1)
sManagementServer = oArgs(2)

Dim WshShell, objEnv, sBasePath, resxFilePrefix
Dim WSHNetwork
Dim localeIndex, language, LocaleLanguage, resourceFile, resxFileObj, resxFile, resxLine, resxStrings, resxKey, resxValue

' Get the WshShell object.
Set WSHNetwork = WScript.CreateObject("WScript.Network")
Set WshShell = WScript.CreateObject("WScript.Shell")
If Err.Number &lt;&gt; 0 Then
ErrMsg = "Object Creation WScript.Shell failed" &amp; vbCrLf _
&amp; "The Error : " &amp; Err.Description &amp; vbCrLf &amp; "was generated in " &amp; Err.Source
Err.Clear
Call oAPI.LogScriptEvent(cEventLogFileName,cEventID, cError, ErrMsg)
Exit Sub
End If

' Get collection by using the Environment property.
Set objEnv = WshShell.Environment("System")

resxFilePrefix = objEnv("MULTIFLEX_MP_INSTALL_PATH")
sBasePath = resxFilePrefix &amp; "\Resources"

Set LocaleLanguage = CreateObject ("Scripting.Dictionary")
If Err.Number &lt;&gt; 0 Then
ErrMsg = "Object Creation Scripting.Dictionary failed" &amp; vbCrLf _
&amp; "The Error : " &amp; Err.Description &amp; vbCrLf &amp; "was generated in " &amp; Err.Source
Err.Clear
Call oAPI.LogScriptEvent(cEventLogFileName,cEventID, cError, ErrMsg)
Exit Sub
End If

LocaleLanguage.Add 1033 , "ENU"
LocaleLanguage.Add 3082 , "ESN"
LocaleLanguage.Add 1036 , "FRA"
LocaleLanguage.Add 1040 , "ITA"
LocaleLanguage.Add 1041 , "JPN"
LocaleLanguage.Add 1042 , "KOR"
LocaleLanguage.Add 1046 , "PTB"
LocaleLanguage.Add 1049 , "RUS"
LocaleLanguage.Add 2052 , "CHS"
LocaleLanguage.Add 1028 , "CHT"
LocaleLanguage.Add 1031 , "DEU"

localeIndex = getLocale()

if(LocaleLanguage.Exists(localeIndex)) Then
language = LocaleLanguage.Item(localeIndex)
else
language = "ENU"
End if

resxFilePrefix = sBasePath &amp; "\\" &amp; language &amp; "\\ResourceStrings"
resourceFile = resxFilePrefix &amp; "." &amp; language

Set resxFileObj = CreateObject ("Scripting.FileSystemObject")
If Err.Number &lt;&gt; 0 Then
ErrMsg = "Object Creation Scripting.FileSystemObject failed" &amp; vbCrLf _
&amp; "The Error : " &amp; Err.Description &amp; vbCrLf &amp; "was generated in " &amp; Err.Source
Err.Clear
Call oAPI.LogScriptEvent(cEventLogFileName,cEventID, cError, ErrMsg)
Exit Sub
End If

If resxFileObj.FileExists (resourceFile) Then
resourceFile = resxFilePrefix &amp; "." &amp; language
else
resxFilePrefix = sBasePath &amp; "\\" &amp; "ENU" &amp; "\\ResourceStrings"
resourceFile = resxFilePrefix &amp; "." &amp; "ENU"
End if

Set resxStrings = CreateObject ("Scripting.Dictionary")
If Err.Number &lt;&gt; 0 Then
ErrMsg = "Object Creation Scripting.Dictionary failed" &amp; vbCrLf _
&amp; "The Error : " &amp; Err.Description &amp; vbCrLf &amp; "was generated in " &amp; Err.Source
Err.Clear
Call oAPI.LogScriptEvent(cEventLogFileName,cEventID, cError, ErrMsg)
Exit Sub
End If

Set resxFile = resxFileObj.OpenTextFile (resourceFile, 1, False)
If Err.Number &lt;&gt; 0 Then
ErrMsg = "The resource file " &amp; resourceFile _
&amp; " could not be found or read! Script is exiting with error! The following error was generated" _
&amp; vbCrLf &amp; Err.Description
Err.Clear
Call oAPI.LogScriptEvent(cEventLogFileName,cEventID, cError, ErrMsg)
Exit Sub
End If
resxLine = resxFile.ReadLine 'Read [strings] line and ignore it
Do While resxFile.AtEndOfStream = False
resxLine = resxFile.ReadLine
resxKey = Mid(resxLine, 1, 4)
if resxKey = 1147 then
resxValue = Mid(resxLine, 6)
resxStrings.Add resxKey, resxValue
end if
Loop
resxFile.Close

' Initialize DiscoveryData
Err.Clear
Set oDiscoveryData = oAPI.CreateDiscoveryData(0, sSourceID, sManagedEntityId)
If Err.Number &lt;&gt; 0 Then
ErrMsg = "Creation of Discovery data failed! The Error : " _
&amp; Err.Description &amp; vbCrLf &amp; "was generated in " &amp; Err.Source
Err.Clear
Call oAPI.LogScriptEvent(cEventLogFileName,cEventID, cError, ErrMsg)
Exit Sub
End If

Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Intel.Hardware.ModularServer.GroupConfiguration']$")
Call oInst.AddProperty("$MPElement[Name='Intel.Hardware.ModularServer.GroupConfiguration']/ManagementServer$", sManagementServer)
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", resxStrings.Item ("1147"))
Call oDiscoveryData.AddInstance(oInst)

'Submit DiscoveryData
Call oAPI.Return(oDiscoveryData)
End Sub

' ---- End of main code -----
</Script></ScriptBody>
<TimeoutSeconds>20</TimeoutSeconds>
</DataSource>
</Discovery>