Discovers Tenants

Microsoft.Windows.RemoteAccess.MultiTenant.2012.R2.Discover.Tenants (Discovery)

Discovers Tenants/Routing Domains that are configured for RRAS

Element properties:

TargetMicrosoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.RemoteAccessServer
EnabledTrue
Frequency7200
RemotableFalse

Object Discovery Details:

Discovered Classes and their attribuets:
  • Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant
    • TenantName
    • RoutingDomain
    • RoutingDomainID
    • ServerName
    • StandByServer
    • CompartmentID
    • VSIDs
    • S2SConfigured
    • BGPConfigured
    • VPNConfigured
    • RoutingDomainStatus
    • Capacity
    • VPNAuthTenantName
    • RoutingStatus
    • IPAddressRange
    • InterimAccounting
    • EncryptionType
    • CustomPolicy
    • IdleDisconnectSeconds
    • SADataSizeForRenegotiation
    • SALifeTime
    • AuthenticationTransformConstants
    • DHGroup
    • CipherTransformConstants
    • EncryptionMethod
    • IntegrityCheckMethod
    • PfsGroup
    • DisplayName
Discovered relationships and their attribuets:

Member Modules:

ID Module Type TypeId RunAs 
PSDiscoverTenants DataSource Microsoft.Windows.TimedPowerShell.DiscoveryProvider Default

Source Code:

<Discovery ID="Microsoft.Windows.RemoteAccess.MultiTenant.2012.R2.Discover.Tenants" Target="Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.RemoteAccessServer" Enabled="true" ConfirmDelivery="false" Remotable="true" Priority="Normal">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant">
<Property TypeID="Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant" PropertyID="TenantName"/>
<Property TypeID="Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant" PropertyID="RoutingDomain"/>
<Property TypeID="Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant" PropertyID="RoutingDomainID"/>
<Property TypeID="Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant" PropertyID="ServerName"/>
<Property TypeID="Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant" PropertyID="StandByServer"/>
<Property TypeID="Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant" PropertyID="CompartmentID"/>
<Property TypeID="Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant" PropertyID="VSIDs"/>
<Property TypeID="Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant" PropertyID="S2SConfigured"/>
<Property TypeID="Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant" PropertyID="BGPConfigured"/>
<Property TypeID="Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant" PropertyID="VPNConfigured"/>
<Property TypeID="Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant" PropertyID="RoutingDomainStatus"/>
<Property TypeID="Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant" PropertyID="Capacity"/>
<Property TypeID="Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant" PropertyID="VPNAuthTenantName"/>
<Property TypeID="Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant" PropertyID="RoutingStatus"/>
<Property TypeID="Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant" PropertyID="IPAddressRange"/>
<Property TypeID="Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant" PropertyID="InterimAccounting"/>
<Property TypeID="Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant" PropertyID="EncryptionType"/>
<Property TypeID="Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant" PropertyID="CustomPolicy"/>
<Property TypeID="Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant" PropertyID="IdleDisconnectSeconds"/>
<Property TypeID="Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant" PropertyID="SADataSizeForRenegotiation"/>
<Property TypeID="Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant" PropertyID="SALifeTime"/>
<Property TypeID="Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant" PropertyID="AuthenticationTransformConstants"/>
<Property TypeID="Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant" PropertyID="DHGroup"/>
<Property TypeID="Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant" PropertyID="CipherTransformConstants"/>
<Property TypeID="Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant" PropertyID="EncryptionMethod"/>
<Property TypeID="Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant" PropertyID="IntegrityCheckMethod"/>
<Property TypeID="Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant" PropertyID="PfsGroup"/>
<Property TypeID="System!System.Entity" PropertyID="DisplayName"/>
</DiscoveryClass>
<DiscoveryRelationship TypeID="Microsoft.Windows.RemoteAccess.MultiTenant.2012.R2.RemoteAccess.Hosts.Tenant"/>
</DiscoveryTypes>
<DataSource ID="PSDiscoverTenants" TypeID="Windows!Microsoft.Windows.TimedPowerShell.DiscoveryProvider">
<IntervalSeconds>7200</IntervalSeconds>
<SyncTime/>
<ScriptName>DiscoverTenants.ps1</ScriptName>
<ScriptBody><Script>

param($sourceId,$managedEntityId,$computerName,$standByServer)

$EventLog = new-object System.Diagnostics.EventLog('Application')
$EventLog.MachineName = "."
$EventLog.Source = "TenantsDiscovery"

$api = new-object -comObject 'MOM.ScriptAPI'
$discoveryData = $api.CreateDiscoveryData(0, $sourceId, $managedEntityId)

function GetCompartmentId
{
param($routingDomainID, $Compartments)

$compartment = $Compartments | Where CompartmentGuid -eq $routingDomainID

if($compartment -ne $null)
{
return $compartment.CompartmentId
}

}


function GetVSIDs
{
param($compartmentID, $NetIpInterface)

$isolatonIds = @($NetIpInterface | Where CompartmentId -eq $compartmentID | Select-Object IsolationId | Sort-Object IsolationId).IsolationId

$uniqueIsolationIds = @($isolatonIds | Get-Unique)

for($i=0; $i -lt $uniqueIsolationIds.Count;)
{
if($uniqueIsolationIds[$i] -ne 0)
{
$isolatonIdList = $isolatonIdList + $uniqueIsolationIds[$i].ToString()
$i++
if($i -lt $uniqueIsolationIds.Count)
{
$isolatonIdList = $isolatonIdList + ","
}
}
else
{
$i++
}
}
return $isolatonIdList

}

function GetRoutinggDomainObject
{
param($routingDomain, $Object)

return ($Object | Where RoutingDomain -eq $routingDomain)
}


try{
$routingDomains = @(get-remoteaccessroutingdomain)
if($routingDomains.Count -gt 0){

$Compartments = @(Get-NetCompartment)
$NetIpInterface = @(Get-NetIPInterface -IncludeAllCompartments)
$BgpRouters = @()
try{
$BgpRouters = @(Get-BgpRouter)
}
catch{ }

for($k = 0; $k -lt $routingDomains.Count; $k++)
{
$rd = $discoveryData.CreateClassInstance("$MPElement[Name='Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant']$")
$rd.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $computerName)
$rd.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $routingDomains[$k].RoutingDomain.ToString())
$rd.AddProperty("$MPElement[Name='Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant']/ServerName$", $computerName)


$rd.AddProperty("$MPElement[Name='Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant']/TenantName$", $routingDomains[$k].RoutingDomain.ToString())
$rd.AddProperty("$MPElement[Name='Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant']/RoutingDomain$", $routingDomains[$k].RoutingDomain.ToString())
$rd.AddProperty("$MPElement[Name='Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant']/RoutingDomainID$", $routingDomains[$k].RoutingDomainID.Split("{}")[1].ToString())
$rd.AddProperty("$MPElement[Name='Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant']/StandByServer$", $standByServer)
$compartmentId = GetCompartmentID -routingDomainID $routingDomains[$k].RoutingDomainID -Compartments $Compartments
if($compartmentId -ne $null)
{
$rd.AddProperty("$MPElement[Name='Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant']/CompartmentID$",$compartmentId)
}

$rd.AddProperty("$MPElement[Name='Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant']/S2SConfigured$", $routingDomains[$k].VpnS2SStatus.ToString())
$bgpRouter = $null
if($BgpRouters -ne $null)
{
$bgpRouter = GetRoutinggDomainObject -routingDomain $routingDomains[$k].RoutingDomain -Object $BgpRouters
}
if( $bgpRouter -ne $null)
{
$bgpStatus = "Enabled"
}
else
{
$bgpStatus = "Disabled"
}
$rd.AddProperty("$MPElement[Name='Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant']/BGPConfigured$", $bgpStatus)
$rd.AddProperty("$MPElement[Name='Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant']/VPNConfigured$", $routingDomains[$k].VpnStatus.ToString())

if($routingDomains[$k].RxBandwidthKbps -ne $null)
{
$rd.AddProperty("$MPElement[Name='Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant']/Capacity$", $routingDomains[$k].RxBandwidthKbps)
}
$tenantNames = @($routingDomains[$k].TenantName)
$vpnAuthTenantName = $null
if($tenantNames -ne $null)
{
$vpnAuthTenantName = $tenantNames -join ","
}
$rd.AddProperty("$MPElement[Name='Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant']/VPNAuthTenantName$", $vpnAuthTenantName)
$rd.AddProperty("$MPElement[Name='Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant']/RoutingStatus$", $routingDomains[$k].RoutingStatus.ToString())
$vsidIds = $null
if($compartmentId -ne $null)
{
$vsidIds = GetVSIDs -compartmentID $compartmentId -NetIpInterface $NetIpInterface
}
$rd.AddProperty("$MPElement[Name='Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant']/VSIDs$", $vsidIds)
$ipAddressRanges = @($routingDomains[$k].IPRange)
$ipAddresses = $null
if($ipAddressRanges -ne $null)
{
$ipAddresses = $ipAddressRanges -join ","
}
$rd.AddProperty("$MPElement[Name='Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant']/IPAddressRange$", $ipAddresses)
$rd.AddProperty("$MPElement[Name='Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant']/RoutingDomainStatus$", $routingDomains[$k].RoutingDomainStatus.ToString())
$CustomPolicyExists = ($routingDomains[$k] | gm | Where Name -eq CustomPolicy) -ne $null

if($routingDomains[$k].InterimAccountingPeriodSec -ne $null)
{
$rd.AddProperty("$MPElement[Name='Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant']/InterimAccounting$", $routingDomains[$k].InterimAccountingPeriodSec)
}
if($CustomPolicyExists)
{
$rd.AddProperty("$MPElement[Name='Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant']/CustomPolicy$", "Enabled")
if($routingDomains[$k].SaRenegotiationDataSizeKB -ne $null)
{
$rd.AddProperty("$MPElement[Name='Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant']/IdleDisconnectSeconds$", $routingDomains[$k].IdleDisconnectSec)
}
if($routingDomains[$k].SaRenegotiationDataSizeKB -ne $null)
{
$rd.AddProperty("$MPElement[Name='Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant']/SADataSizeForRenegotiation$", $routingDomains[$k].SaRenegotiationDataSizeKB)
}
if($routingDomains[$k].SaLifeTimeSec -ne $null)
{
$rd.AddProperty("$MPElement[Name='Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant']/SALifeTime$", $routingDomains[$k].SaLifeTimeSec)
}
$rd.AddProperty("$MPElement[Name='Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant']/AuthenticationTransformConstants$", $routingDomains[$k].AuthenticationTransformConstant.ToString())
$rd.AddProperty("$MPElement[Name='Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant']/DHGroup$", $routingDomains[$k].DHGroup.ToString())
$rd.AddProperty("$MPElement[Name='Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant']/CipherTransformConstants$", $routingDomains[$k].CipherTransformConstant.ToString())
$rd.AddProperty("$MPElement[Name='Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant']/EncryptionMethod$", $routingDomains[$k].EncryptionMethod.ToString())
$rd.AddProperty("$MPElement[Name='Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant']/IntegrityCheckMethod$", $routingDomains[$k].IntegrityCheckMethod.ToString())
$rd.AddProperty("$MPElement[Name='Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant']/PfsGroup$", $routingDomains[$k].PFSGroup.ToString())
}
else
{
$rd.AddProperty("$MPElement[Name='Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant']/CustomPolicy$", "Disabled")
$rd.AddProperty("$MPElement[Name='Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.Tenant']/EncryptionType$", $routingDomains[$k].EncryptionType.ToString())
}
$rd.AddProperty("$MPElement[Name='Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.RemoteAccessServer']/ServerName$", $computerName)
$discoveryData.AddInstance($rd)
}

}
}
catch{
$EventLog.WriteEntry("[TenantsDiscovery] Error occured while running Discovery at (" + $computerName + ")" )
$EventLog.WriteEntry("[TenantsDiscovery] Error Data: " + $_)
}

$discoveryData</Script></ScriptBody>
<Parameters>
<Parameter>
<Name>sourceID</Name>
<Value>$MPElement$</Value>
</Parameter>
<Parameter>
<Name>managedEntityID</Name>
<Value>$Target/Id$</Value>
</Parameter>
<Parameter>
<Name>computerName</Name>
<Value>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Value>
</Parameter>
<Parameter>
<Name>standByServer</Name>
<Value>$Target/Property[Type="Microsoft.Windows.RemoteAccess.Multitenant.2012.R2.Class.RemoteAccessServer"]/StandByServer$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>900</TimeoutSeconds>
</DataSource>
</Discovery>