Exchange 2003 Queue Discovery

Microsoft.Exchange.Routing.Queue.Discovery (Discovery)

This rule discovers the Exchange 2003 Queue Monitoring Component

Knowledge Base article:

Summary

This discovery rule discovers the Exchange 2003 Queue monitoring component on an Exchange Backend server.

Configuration

There is no configuration required. To disable local Exchange 2003 Server role discovery disable (override) the rule “Exchange 2003 Server Initial Discovery”.

Element properties:

TargetMicrosoft.Exchange.ServerRole.2003
EnabledTrue
Frequency3600
RemotableFalse

Object Discovery Details:

Discovered Classes and their attribuets:

Member Modules:

ID Module Type TypeId RunAs 
DiscoveryDataSource DataSource System.CommandExecuterDiscoveryDataSource Default

Source Code:

<Discovery ID="Microsoft.Exchange.Routing.Queue.Discovery" Enabled="onStandardMonitoring" Target="Microsoft.Exchange.ServerRole.2003" ConfirmDelivery="false" Remotable="true" Priority="Normal">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="Microsoft.Exchange.Routing.Queue"/>
</DiscoveryTypes>
<DataSource ID="DiscoveryDataSource" TypeID="System!System.CommandExecuterDiscoveryDataSource">
<IntervalSeconds>3600</IntervalSeconds>
<ApplicationName>%windir%\System32\cscript.exe</ApplicationName>
<WorkingDirectory/>
<CommandLine>$file/DiscoverMicrosoftExchangeRoutingQueue.js$ 0 $MPElement$ $Target/Id$ $Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$ $Target/Property[Type="Microsoft.Exchange.ServerRole.2003"]/DistinguishedName$ $Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetbiosComputerName$</CommandLine>
<TimeoutSeconds>300</TimeoutSeconds>
<RequireOutput>true</RequireOutput>
<Files>
<File>
<Name>DiscoverMicrosoftExchangeRoutingQueue.js</Name>
<Contents><Script>
//Copyright (c) Microsoft Corporation. All rights reserved.
//*************************************************************
// $ScriptName: "Exchange - Database Discovery" $
//
// TBD: This assumes that there are no Public Folders and/or Mailboxes on a frontend server.
// However this is not a must requirement, just a recommendation.
// For now we assume that a Frontend server does not have databases
//
// $File: DiscoverMicrosoftExchangeRoutingQueue.js $
//
//*************************************************************


// Fetch the parameters
// If the number of arguments is less than 3, quit

//var FQDN, NetbiosComputername, ShortNetbiosDomainname
var SourceType, SourceID, ManagedEntityId, TargetComputer,DistinguishedName,NetbiosComputerName;

if(WScript.Arguments.Unnamed.Count == 6){
SourceType = WScript.Arguments(0);
SourceID = WScript.Arguments(1) ;
ManagedEntityId = WScript.Arguments(2);
TargetComputer = WScript.Arguments(3);
DistinguishedName = WScript.Arguments(4);
NetbiosComputerName = WScript.Arguments(5);
}else{
WScript.quit();
}

var oAPI;
oAPI = new ActiveXObject("Mom.ScriptAPI");

function CreateEvent(strSource, lngEventID, lngEventType, strMsg)
{
oAPI.LogScriptEvent(strSource, lngEventID, lngEventType, strMsg);
}

function IsFrontEnd(strServerName)
{
var oConnect = new ActiveXObject("ADODB.Connection");
oConnect.Provider = "ADsDSOObject";
oConnect.Open();
var command = new ActiveXObject("ADODB.Command");
command.ActiveConnection = oConnect;
var objRootDSE = GetObject("LDAP://rootDSE");

command.CommandText = "SELECT CN FROM 'LDAP://" + objRootDSE.Get("configurationNamingContext") + "' WHERE CN='" + strServerName + "' AND serverRole=1";
command.Properties("Page Size") = 100;
command.Properties("Timeout") = 10;
command.Properties("searchscope") = 2;
command.Properties("Chase referrals") = 0x20 | 0x40;
command.Properties("Cache Results") = false;
var rs = command.Execute();

var boolIsFrontEnd = false;
if (!rs.EOF){
rs.MoveFirst();
if (rs.Fields(0).Value.toUpperCase() == strServerName.toUpperCase())
boolIsFrontEnd = true;
}
return boolIsFrontEnd;
}


MainRoutine:
{
var discoveryData;
discoveryData = oAPI.CreateDiscoveryData(SourceType, SourceID, ManagedEntityId);

if(IsFrontEnd(NetbiosComputerName)==false){
var oExchangeRoutingQueueInstance;
// Create Server (Exchange &amp; Exchange Frontend) collection with the
// Computer (full netbios name: domain\servername) as scope
oExchangeRoutingQueueInstance = discoveryData.CreateClassInstance("$MPElement[Name='Microsoft.Exchange.Routing.Queue']$");
oExchangeRoutingQueueInstance.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", TargetComputer);
oExchangeRoutingQueueInstance.AddProperty("$MPElement[Name='Microsoft.Exchange.ServerRole.2003']/DistinguishedName$", DistinguishedName);
oExchangeRoutingQueueInstance.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "Queue");
// Add it to the discovery data
discoveryData.AddInstance(oExchangeRoutingQueueInstance);
}

// Pass back the result to MOM
oAPI.Return(discoveryData);
}//MainRoutine
</Script></Contents>
</File>
</Files>
</DataSource>
</Discovery>