Distribution Point Drive Discovery Probe Action

MECM.ContentDrive.Discovery.PA (ProbeActionModuleType)

This probe finds the drives used by distribution points.

Element properties:

TypeProbeActionModuleType
IsolationAny
AccessibilityPublic
RunAsDefault
InputTypeSystem.BaseData
OutputTypeSystem.Discovery.Data

Member Modules:

ID Module Type TypeId RunAs 
PA ProbeAction MECM.Script.Discovery.PA Default

Overrideable Parameters:

IDParameterTypeSelectorDisplay NameDescription
LogLevelint$Config/LogLevel$LogLevel (0, 1, 2)

Source Code:

<ProbeActionModuleType ID="MECM.ContentDrive.Discovery.PA" Accessibility="Public" Batching="false" PassThrough="false">
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="LogLevel" type="xsd:integer"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="Arguments" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="TimeoutSeconds" type="xsd:integer"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="LogLevel" Selector="$Config/LogLevel$" ParameterType="int"/>
</OverrideableParameters>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<ProbeAction ID="PA" TypeID="MECM.Script.Discovery.PA">
<ScriptName>ContentDriveDiscovery.js</ScriptName>
<LogLevel>$Config/LogLevel$</LogLevel>
<Arguments>$Config/Arguments$</Arguments>
<ScriptBody><Script><!-- $IncludeFileContent/"../../../Scripts/Discovery/ContentWmi.js"$ --><!-- $IncludeFileContent/"../../../Scripts/Discovery/_Return.js"$ -->(function ($, cim, data) {
// BEGIN Discovery(MEF $, WMI sccm, DiscoveryData data)

var roleClassMap = $("ConfigMgr.RoleClassMap");

var numArgs = $.Arguments.Count();
// ParseToInt
var targetServerFqdn = cim.CurrentServer;

var roleName = "SMS_Distribution_Point";
var roleClass = roleClassMap(roleName);

if (roleClass != undefined) {
var roleDef = data.CreateClassInstance(roleClass);
roleDef.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", targetServerFqdn);

data.AddInstance(roleDef);

var regPath = "SOFTWARE\\Microsoft\\SMS\\DP";
var regKey = "ContentLibUsableDrives";

// service query
var contentPath = cim.GetRegistryStringValue(regPath, regKey);

if ($.IsNullOrEmpty(contentPath) == false)
{
var relationship;
var driveList = {};

$.ForEach(contentPath.split(","), function () {
var drive = $.Trim(this);

var regEx = new RegExp("^[a-zA-Z]:");

var match = regEx.exec(drive);
if (match == null) {
drive = "";
} else if (match.length &gt; 0) {
drive = match[0].toUpperCase();
} else {
drive = "";
}

if ($.IsNullOrEmpty(drive) == false &amp;&amp;
driveList[drive] === undefined)
{
var drvDef = data.CreateClassInstance("$MPElement[Name='MECM.ContentStorageDrive']$");
drvDef.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", targetServerFqdn);
drvDef.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.LogicalDevice']/DeviceID$", drive);

data.AddInstance(drvDef);

// to ignore duplicate entries
driveList[drive] = drvDef;

relationship = data.CreateRelationshipInstance("$MPElement[Name='MECM.SiteRoleContainsContentStorage']$")
relationship.Source = roleDef;
relationship.Target = drvDef;

data.AddInstance(relationship);
}
});
}
}

// END Discovery(MEF $, WMI sccm, DiscoveryData data)
})($, $("CIMv2"), $("DiscoveryData"));


$.Return($("DiscoveryData"));

</Script></ScriptBody>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
</ProbeAction>
</MemberModules>
<Composition>
<Node ID="PA"/>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.Discovery.Data</OutputType>
<InputType>System!System.BaseData</InputType>
</ProbeActionModuleType>