Detecta servidores de Microsoft System Center Service Manager
Knowledge Base article:
Resumen
Si se deshabilita la detección, no se puede detectar el Service Manager. La detección se ejecuta una vez al día. No obstante, se puede reemplazar la frecuencia para cambiarla.
Call oAPI.LogScriptEvent("SmManagementServerDiscovery.vbs", 3000, 4, "Starting discovery of Service Manager Management Server.")
Dim oReg, arrSubKeys, sdkServiceType, iResult, oDiscoveryData, oInst, currentVersion
Set oDiscoveryData = oAPI.CreateDiscoveryData(0, sourceId, managedEntityId)
Set oReg = GetObject("winmgmts:\\" & principalName & "\root\default:StdRegProv")
If Err <> 0 Then
Call oAPI.LogScriptEvent("SmManagementServerDiscovery.vbs", 3000, 4, "Unable to bind to WMI registry provider on " & principalName & ". Terminating Discovery.")
Call oAPI.Return(oDiscoveryData)
WScript.Quit
End if
Const HKEY_LOCAL_MACHINE = &H80000002
'Begin SCSM 2010 Discovery
iResult = oReg.Enumkey(HKEY_LOCAL_Machine, "SOFTWARE\Microsoft\System Center\2010\Service Manager\Setup", arrSubKeys)
If iResult = 0 then
iResult = oReg.Enumkey(HKEY_LOCAL_Machine, "SOFTWARE\Microsoft\Microsoft Operations Manager\3.0\Server Management Groups", arrSubKeys)
If iResult = 0 then
iResult = oReg.GetDWORDValue(HKEY_LOCAL_Machine, "SOFTWARE\Microsoft\System Center\2010\Common\SDK Service", "SDK Service Type", sdkServiceType)
If iResult = 0 then
If sdkServiceType = 1 then
iResult = oReg.GetStringValue(HKEY_LOCAL_Machine, "SOFTWARE\Microsoft\System Center\2010\Service Manager\Setup", "CurrentVersion", currentVersion)
If iResult = 0 then
'Determine SM Version
Dim iMajorProductVersion, iMinorProductVersion, iFirstPeriod, iSecondPeriod, Version
iFirstPeriod = InStr(currentVersion, ".")
iSecondPeriod = InStr(iFirstPeriod+1, currentVersion,".")
iMajorProductVersion = Left(currentVersion, iFirstPeriod-1)
iMinorProductVersion = Mid(currentVersion, iFirstPeriod+1, iSecondPeriod-iFirstPeriod-1)
If iMajorProductVersion = 7 and iMinorProductVersion = 0 then
Version = "2010"
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='SM!Microsoft.SystemCenter.ServiceManager.SmManagementServer.2010']$")
ElseIf iMajorProductVersion = 7 and iMinorProductVersion = 5 then
Version = "2012"
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='SM!Microsoft.SystemCenter.ServiceManager.SmManagementServer.2012']$")
Else
Call oAPI.LogScriptEvent("SmManagementServerDiscovery.vbs", 3000, 4, "Did not recognise Service Manager Version, terminating discovery.")
Call oAPI.Return(oDiscoveryData)
WScript.Quit
End If
Call oAPI.LogScriptEvent("SmManagementServerDiscovery.vbs", 3000, 4, "Discovered SCSM "& Version &" Management Server.")
Call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", principalName)
Call oInst.AddProperty("$MPElement[Name='SM!Microsoft.SystemCenter.ServiceManager.SmManagementServer']/ServerName$", networkName)
Call oInst.AddProperty("$MPElement[Name='SM!Microsoft.SystemCenter.ServiceManager.ManagementServer']/Version$", Version)
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", principalName)
Call oDiscoveryData.AddInstance(oInst)
End If
End If
End If
End If
End If
Call oAPI.Return(oDiscoveryData)
Call oAPI.LogScriptEvent("SmManagementServerDiscovery.vbs", 3000, 4, "Ending discovery of Service Manager Management Server.")
WScript.Quit </Script></ScriptBody>
<TimeoutSeconds>300</TimeoutSeconds>
</DataSource>
</Discovery>