<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.
'
Set oAPI = CreateObject("MOM.ScriptAPI")
If Err.Number <> 0 Then
ErrMsg = "Object Creation MOM.ScriptAPI failed" & vbCrLf _
& "The Error : " & Err.Description & vbCrLf & "was generated in " & Err.Source
Err.Clear
Call oAPI.LogScriptEvent(cEventLogFileName,cEventID, cError, ErrMsg)
Exit Sub
End If
Set oArgs = WScript.Arguments
if oArgs.Count <> 3 Then
Call oAPI.LogScriptEvent(cEventLogFileName,cEventID, cError, _
"Insufficient Arguments in " & cEventLogFileName)
Wscript.Quit -1
End If
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 <> 0 Then
ErrMsg = "Object Creation WScript.Shell failed" & vbCrLf _
& "The Error : " & Err.Description & vbCrLf & "was generated in " & 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 & "\Resources"
Set LocaleLanguage = CreateObject ("Scripting.Dictionary")
If Err.Number <> 0 Then
ErrMsg = "Object Creation Scripting.Dictionary failed" & vbCrLf _
& "The Error : " & Err.Description & vbCrLf & "was generated in " & Err.Source
Err.Clear
Call oAPI.LogScriptEvent(cEventLogFileName,cEventID, cError, ErrMsg)
Exit Sub
End If
if(LocaleLanguage.Exists(localeIndex)) Then
language = LocaleLanguage.Item(localeIndex)
else
language = "ENU"
End if
resxFilePrefix = sBasePath & "\\" & language & "\\ResourceStrings"
resourceFile = resxFilePrefix & "." & language
Set resxFileObj = CreateObject ("Scripting.FileSystemObject")
If Err.Number <> 0 Then
ErrMsg = "Object Creation Scripting.FileSystemObject failed" & vbCrLf _
& "The Error : " & Err.Description & vbCrLf & "was generated in " & Err.Source
Err.Clear
Call oAPI.LogScriptEvent(cEventLogFileName,cEventID, cError, ErrMsg)
Exit Sub
End If
If resxFileObj.FileExists (resourceFile) Then
resourceFile = resxFilePrefix & "." & language
else
resxFilePrefix = sBasePath & "\\" & "ENU" & "\\ResourceStrings"
resourceFile = resxFilePrefix & "." & "ENU"
End if
Set resxStrings = CreateObject ("Scripting.Dictionary")
If Err.Number <> 0 Then
ErrMsg = "Object Creation Scripting.Dictionary failed" & vbCrLf _
& "The Error : " & Err.Description & vbCrLf & "was generated in " & 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 <> 0 Then
ErrMsg = "The resource file " & resourceFile _
& " could not be found or read! Script is exiting with error! The following error was generated" _
& vbCrLf & 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 <> 0 Then
ErrMsg = "Creation of Discovery data failed! The Error : " _
& Err.Description & vbCrLf & "was generated in " & Err.Source
Err.Clear
Call oAPI.LogScriptEvent(cEventLogFileName,cEventID, cError, ErrMsg)
Exit Sub
End If