Dim oArgs
Set oArgs = WScript.Arguments
if oArgs.Count < 3 Then
Wscript.Quit -1
End If
Dim SourceID, ManagedEntityId, TargetComputerIdentityID
SourceId = oArgs(0)
ManagedEntityId = oArgs(1)
TargetComputerIdentityID = oArgs(2)
Dim oAPI, oDiscoveryData, oInst
Set oAPI = CreateObject("MOM.ScriptAPI")
set oDiscoveryData = oAPI.CreateDiscoveryData(0, SourceId, ManagedEntityId)
Dim oRegistry, strValue
Set oRegistry = CreateObject("WScript.Shell")
On Error Resume Next
strValue = oRegistry.RegRead("HKLM\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0\WSS\ServerRole")
If (Err.Number <> 0) Then
Err.Clear
Call oAPI.Return(oDiscoveryData)
Wscript.Quit
End If
If strValue = "SINGLESERVER" or strValue = "APPLICATION" or strValue = "WFE" Then
' Create the Application instance
set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Microsoft.Windows.SharePoint.Services.3.0.WSS.Server']$")
call oInst.AddProperty("$MPElement[Name='MSWL!Microsoft.Windows.Computer']/PrincipalName$", TargetComputerIdentityID)
call oInst.AddProperty("$MPElement[Name='Microsoft.Windows.SharePoint.Services.3.0.WSS.Server']/Server_Name$", "$Target/Property[Type='MSWL!Microsoft.Windows.Computer']/NetbiosComputerName$")
call oDiscoveryData.AddInstance(oInst)
End If
' Submit the data
Call oAPI.Return(oDiscoveryData)</Script></ScriptBody>
<TimeoutSeconds>300</TimeoutSeconds>
</DataSource>
</Discovery>