DPM server discovery

Microsoft.Windows.SystemCenterDPM2010.ClientAutoDeployment.DPMServerDiscovery (Discovery)

Element properties:

TargetMicrosoft.Windows.Server.Computer
EnabledTrue
Frequency86400
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="Microsoft.Windows.SystemCenterDPM2010.ClientAutoDeployment.DPMServerDiscovery" Enabled="true" Target="Windows!Microsoft.Windows.Server.Computer" ConfirmDelivery="false" Remotable="true" Priority="Normal">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="Microsoft.Windows.SystemCenterDPM2010.ClientAutoDeployment.DPMServer"/>
<DiscoveryRelationship TypeID="Windows!Microsoft.Windows.ComputerHostsLocalApplication"/>
</DiscoveryTypes>
<DataSource ID="DS" TypeID="Windows!Microsoft.Windows.TimedScript.DiscoveryProvider">
<IntervalSeconds>86400</IntervalSeconds>
<SyncTime/>
<ScriptName>DPMDiscovery.vbs</ScriptName>
<Arguments>0 $MPElement$ $Target/Id$ $Target/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$ $Target/Property[Type="Windows!Microsoft.Windows.Computer"]/NetbiosComputerName$</Arguments>
<ScriptBody><Script>SetLocale("en-us")
Set oAPI = CreateObject("MOM.ScriptAPI")
Set oArgs = WScript.Arguments

if oArgs.Count &lt; 5 Then
call oAPI.LogScriptEvent("ClientAutoDeployment::DPMServerDiscovery", 12, 1, "Expected 5 arguments. There were only "_
&amp; oArgs.Count &amp; " arguments. Exiting script.")
Wscript.Quit -1
End If

SourceType = oArgs(0)
SourceId = oArgs(1)
ManagedEntityId = oArgs(2)
TargetComputer = oArgs(3)
NetbiosComputerName = oArgs(4)


Dim dpmProductCodes, installstate, dpmversion

Const msiInstallStateUnknown = -1
Const msiInstallStateAbsent = 2

Set oDiscData = oAPI.CreateDiscoveryData(SourceType, SourceId, ManagedEntityId)

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
&amp; "{impersonationLevel=impersonate}!\\" &amp; strComputer &amp; "\root\cimv2")


dpmProductCodes = Array("{2A78E931-1931-46BA-9EB1-6E052D8927CA}", "{AEFAD2C8-054F-4EBF-8560-C09E883D9999}")
Set oInst = oDiscData.CreateClassInstance("$MPElement[Name="Microsoft.Windows.SystemCenterDPM2010.ClientAutoDeployment.DPMServer"]$")

For Each dpmCode In dpmProductCodes
installstate = MsiQueryProductState(dpmCode)

If installstate = msiInstallStateUnknown or installState = msiInstallStateAbsent then
'MsgBox("Dpm not found")
Else
dpmversion = MsiGetProductInfo(dpmCode)
'MsgBox("DPM is Present:" &amp; dpmversion)

call oInst.AddProperty("$MPElement[Name="Windows!Microsoft.Windows.Computer"]/PrincipalName$", TargetComputer)
call oInst.AddProperty("$MPElement[Name="Microsoft.Windows.SystemCenterDPM2010.ClientAutoDeployment.DPMServer"]/DPMServerName$", TargetComputer)
call oInst.AddProperty("$MPElement[Name="System!System.Entity"]/DisplayName$",NetbiosComputerName)

call oDiscData.AddInstance(oInst)
Exit For
End if
Next


call oAPI.Return(oDiscData)



Function MsiQueryProductState(ProductCode)
Dim InstallState

Dim Installer : Set Installer = Nothing
Set Installer = CreateObject("WindowsInstaller.Installer")
InstallState = Installer.ProductState(ProductCode)

MsiQueryProductState = InstallState

Exit Function
End Function

Function MsiGetProductInfo(ProductCode)
Dim InstallInfo
Dim Installer : Set Installer = Nothing
Set Installer = CreateObject("WindowsInstaller.Installer")
InstallInfo = Installer.ProductInfo(ProductCode,"VersionString")

MsiGetProductInfo = InstallInfo
End Function</Script></ScriptBody>
<TimeoutSeconds>600</TimeoutSeconds>
</DataSource>
</Discovery>