Discover TFS WpBuildWebService, VC, Wareohuse and General Service Web Services

TeamFoundationServer2008.DiscoverTFSWpBuildWebService (Discovery)

Discover TFS WpBuildWebService, VC, Wareohuse and General Service Web Services

Knowledge Base article:

Summary

Discover TFS BuildWebService, Version Control, Warehouse and General Web Services

Element properties:

TargetMicrosoft.Windows.InternetInformationServices.2003.AspNetWebApplicationEndpoint
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="TeamFoundationServer2008.DiscoverTFSWpBuildWebService" Enabled="true" Target="MicrosoftWindowsInternetInformationServices2003!Microsoft.Windows.InternetInformationServices.2003.AspNetWebApplicationEndpoint" ConfirmDelivery="false" Remotable="true" Priority="Normal">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="TeamFoundationServer2008.TFSBuildWebService"/>
<DiscoveryClass TypeID="TeamFoundationServer2008.TFSVersionControlWebService"/>
<DiscoveryClass TypeID="TeamFoundationServer2008.TFSWaehouseWebService"/>
<DiscoveryRelationship TypeID="TeamFoundationServer2008.TFSApplicationTierContainsTFSBuildWebService"/>
<DiscoveryRelationship TypeID="TeamFoundationServer2008.TFSApplicationTierContainsTFSVCWebService"/>
<DiscoveryRelationship TypeID="TeamFoundationServer2008.TFSApplicationTierContainsWarehouseService"/>
</DiscoveryTypes>
<DataSource ID="DS" TypeID="Windows!Microsoft.Windows.TimedScript.DiscoveryProvider">
<IntervalSeconds>900</IntervalSeconds>
<SyncTime/>
<ScriptName>DskTfsBldWbSvcWebApp.vbs</ScriptName>
<Arguments>$MPElement$ $Target/Id$ $Target/Property[Type="MicrosoftWindowsInternetInformationServices2003!Microsoft.Windows.InternetInformationServices.2003.AspNetWebApplicationEndpoint"]/ApplicationVRoot$ $Target/Property[Type="MicrosoftWindowsInternetInformationServices2003!Microsoft.Windows.InternetInformationServices.2003.AspNetWebApplicationEndpoint"]/IISApplicationName$ $Target/Host/Property[Type="MicrosoftWindowsInternetInformationServices2003!Microsoft.Windows.InternetInformationServices.2003.WebSite"]/ApplicationPoolName$ $Target/Host/Property[Type="MicrosoftWindowsInternetInformationServices2003!Microsoft.Windows.InternetInformationServices.2003.WebSite"]/ApplicationPoolID$ $Target/Host/Property[Type="MicrosoftWindowsInternetInformationServicesCommonLibrary!Microsoft.Windows.InternetInformationServices.WebSite"]/SiteID$ $Target/Host/Host/Host/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$ $Target/Host/Host/Host/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetbiosComputerName$</Arguments>
<ScriptBody><Script>Option Explicit

Dim oArgs
Set oArgs = WScript.Arguments

IF oArgs.Count &lt; 9 THEN
'Call TraceLogMessage("Less than the required 9 arguments were supplied")
Wscript.Quit -1

END IF

Dim SourceID, ManagedEntityId, TargetComputer, vTFSATComputerName
Dim vApplicationVRoot, vIISApplicationName, vApplicationPoolName, vApplicationPoolID, vSiteID, vPrincipalName, vNetbiosComputerName

SourceId = oArgs(0)
ManagedEntityId = oArgs(1)

Dim oAPI, oDiscoveryData, oInstBld, oTFSAT, oInstVC, oInstWH, oInstSvc, oRelnShipAtToBld, oRelnShipATtoVC, oRelnShipATtoWH, oRelnShipATtoSvc

'call TraceLogMessage("Creating the source: TFSApplicationTier Class")

'$MPElement$ $Target/Id$
vApplicationVRoot = "$Target/Property[Type="MicrosoftWindowsInternetInformationServices2003!Microsoft.Windows.InternetInformationServices.2003.AspNetWebApplicationEndpoint"]/ApplicationVRoot$"
vIISApplicationName = "$Target/Property[Type="MicrosoftWindowsInternetInformationServices2003!Microsoft.Windows.InternetInformationServices.2003.AspNetWebApplicationEndpoint"]/IISApplicationName$"
vApplicationPoolName = "$Target/Host/Property[Type="MicrosoftWindowsInternetInformationServices2003!Microsoft.Windows.InternetInformationServices.2003.WebSite"]/ApplicationPoolName$"
vApplicationPoolID = "$Target/Host/Property[Type="MicrosoftWindowsInternetInformationServices2003!Microsoft.Windows.InternetInformationServices.2003.WebSite"]/ApplicationPoolID$"
vSiteID = "$Target/Host/Property[Type="MicrosoftWindowsInternetInformationServicesCommonLibrary!Microsoft.Windows.InternetInformationServices.WebSite"]/SiteID$"
vPrincipalName = "$Target/Host/Host/Host/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$"
vNetbiosComputerName = "$Target/Host/Host/Host/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetbiosComputerName$"


IF ( vIISApplicationName = "Build" ) THEN

Set oAPI = CreateObject("MOM.ScriptAPI")
set oDiscoveryData = oAPI.CreateDiscoveryData(0, SourceId, ManagedEntityId)


''''''''Create the source of the relationship first:
set oTFSAT = oDiscoveryData.CreateClassInstance("$MPElement[Name='TeamFoundationServer2008.TFSApplicationTier']$")
call oTFSAT.AddProperty("$MPElement[Name='TeamFoundationServer2008.TFSApplicationTier']/TFSATComputerName$",vPrincipalName )
call oTFSAT.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", vPrincipalName )


''''''''Now Create the target of the relationship
'call TraceLogMessage("Creating the Target: TFSBuildService Class")
set oInstBld = oDiscoveryData.CreateClassInstance("$MPElement[Name='TeamFoundationServer2008.TFSBuildWebService']$")
call oInstBld.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", vPrincipalName )
call oInstBld.AddProperty("$MPElement[Name='MicrosoftWindowsInternetInformationServices2003!Microsoft.Windows.InternetInformationServices.2003.AspNetWebServiceEndpoint']/IISApplicationName$",vIISApplicationName )
call oInstBld.AddProperty("$MPElement[Name='MicrosoftWindowsInternetInformationServicesCommonLibrary!Microsoft.Windows.InternetInformationServices.WebSite']/SiteID$", vSiteID)
call oInstBld.AddProperty("$MPElement[Name='MicrosoftWindowsInternetInformationServices2003!Microsoft.Windows.InternetInformationServices.2003.AspNetWebServiceEndpoint']/ApplicationVRoot$", vApplicationVRoot)
call oInstBld.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", vApplicationVRoot)
'call TraceLogMessage("AddingInstanceData: for TfsBuildWebService")
call oDiscoveryData.AddInstance(oInstBld)

'call TraceLogMessage("Adding Relationship for TfsBuildWebService")
set oRelnShipATtoBld= oDiscoveryData.CreateRelationshipInstance("$MPElement[Name='TeamFoundationServer2008.TFSApplicationTierContainsTFSBuildWebService']$")
oRelnShipATtoBld.Source = oTFSAT
oRelnShipATtoBld.Target = oInstBld
'Call TraceLogMessage("Now Add the AT-To-BuildService Relationship Instance")
Call oDiscoveryData.AddInstance(oRelnShipATtoBld)




'###### Here an assumption is made that the ApplicationRoot is always of a format such as: /TEXT/TEXT/TEXT/TEXT/TEXT ie /LM/W3SVC/NNNNNNNNNNN/Root/Build.
'###### Rebuild the string for ApplicationVROOT to use /TEXT/TEXT/TEXT/TEXT/VersionControl

Dim var1, newAppRoot
var1 = split(vApplicationVRoot,"/")
newAppRoot = var1(0)&amp;"/"&amp;var1(1)&amp;"/"&amp;var1(2)&amp;"/"&amp;var1(3)&amp;"/"&amp;var1(4)&amp;"/VersionControl"
'call TraceLogMessage("VersionControl App Root:=&gt; "&amp;newAppRoot )


''''''''For some strange reason the ASP.NET MP does not detect VersionControl, Warehouse and Services end points. So they are added in the code below.
''''''''Now Create the 2nd target of the relationship, namely VersionControl
'call TraceLogMessage("Creating the Target: TFSVersionControlWebService Class")
set oInstVC = oDiscoveryData.CreateClassInstance("$MPElement[Name='TeamFoundationServer2008.TFSVersionControlWebService']$")
call oInstVC.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", vPrincipalName )
call oInstVC.AddProperty("$MPElement[Name='MicrosoftWindowsInternetInformationServices2003!Microsoft.Windows.InternetInformationServices.2003.AspNetWebServiceEndpoint']/IISApplicationName$","VersionControl" )
call oInstVC.AddProperty("$MPElement[Name='MicrosoftWindowsInternetInformationServicesCommonLibrary!Microsoft.Windows.InternetInformationServices.WebSite']/SiteID$", vSiteID)
call oInstVC.AddProperty("$MPElement[Name='MicrosoftWindowsInternetInformationServices2003!Microsoft.Windows.InternetInformationServices.2003.AspNetWebServiceEndpoint']/ApplicationVRoot$", newAppRoot)
call oInstVC.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", newAppRoot)
'call TraceLogMessage("AddingInstanceData: for TfsVersionControlWebService")
call oDiscoveryData.AddInstance(oInstVC)

'call TraceLogMessage("Adding Relationship for TfsVCWebService")
set oRelnShipATtoVC= oDiscoveryData.CreateRelationshipInstance("$MPElement[Name='TeamFoundationServer2008.TFSApplicationTierContainsTFSVCWebService']$")
oRelnShipATtoVC.Source = oTFSAT
oRelnShipATtoVC.Target = oInstVC
'Call TraceLogMessage("Now Add the AT-To-VC-Service Relationship Instance")
Call oDiscoveryData.AddInstance(oRelnShipATtoVC)


''''''''Now Create the 3nd target of the relationship, namely Warehouse
'call TraceLogMessage("Creating the Target: TFSWarehouseWebService Class")
newAppRoot = var1(0)&amp;"/"&amp;var1(1)&amp;"/"&amp;var1(2)&amp;"/"&amp;var1(3)&amp;"/"&amp;var1(4)&amp;"/Warehouse"
set oInstWH = oDiscoveryData.CreateClassInstance("$MPElement[Name='TeamFoundationServer2008.TFSWaehouseWebService']$")
call oInstWH.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", vPrincipalName )
call oInstWH.AddProperty("$MPElement[Name='MicrosoftWindowsInternetInformationServices2003!Microsoft.Windows.InternetInformationServices.2003.AspNetWebServiceEndpoint']/IISApplicationName$","Warehouse" )
call oInstWH.AddProperty("$MPElement[Name='MicrosoftWindowsInternetInformationServicesCommonLibrary!Microsoft.Windows.InternetInformationServices.WebSite']/SiteID$", vSiteID)
call oInstWH.AddProperty("$MPElement[Name='MicrosoftWindowsInternetInformationServices2003!Microsoft.Windows.InternetInformationServices.2003.AspNetWebServiceEndpoint']/ApplicationVRoot$", newAppRoot)
call oInstWH.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", newAppRoot)
'call TraceLogMessage("AddingInstanceData: for TfsWarehouseWebService")
call oDiscoveryData.AddInstance(oInstWH)

'call TraceLogMessage("Adding Relationship for TfsVCWebService")
set oRelnShipATtoWH= oDiscoveryData.CreateRelationshipInstance("$MPElement[Name='TeamFoundationServer2008.TFSApplicationTierContainsWarehouseService']$")
oRelnShipATtoWH.Source = oTFSAT
oRelnShipATtoWH.Target = oInstWH
'Call TraceLogMessage("Now Add the AT-To-WH-Service Relationship Instance")
Call oDiscoveryData.AddInstance(oRelnShipATtoWH)





Call oAPI.Return(oDiscoveryData)

ELSE

'Call TraceLogMessage(" Not a Build Web Service : vIISApplicationName != Build ")
Wscript.Quit -1

END IF

'''##### TraceLogMessage ######################
Function TraceLogMessage(ByVal sMessage)
Dim lsEventInformation
WScript.Echo sMessage

' Retrieve the name of this (running) script
Dim FSO, ScriptFileName
Set FSO = CreateObject("Scripting.FileSystemObject")
ScriptFileName = FSO.GetFile(WScript.ScriptFullName).Name
Set FSO = Nothing

On Error Resume Next
Dim oAPITemp
Set oAPITemp = CreateObject("MOM.ScriptAPI")
lsEventInformation = 3
oAPITemp.LogScriptEvent ScriptFileName, 4000, lsEventInformation, sMessage
On Error Goto 0
End Function


</Script></ScriptBody>
<TimeoutSeconds>360</TimeoutSeconds>
</DataSource>
</Discovery>