O365SMP O365Portal Login Performance Collection Rule ProbeActionModuleType

O365SMP.O365Portal_Login.Performance.Collection.Rule.ProbeActionModuleType (ProbeActionModuleType)

Probe Action Module Type for Performance Rule: O365SMP.O365Portal_Login.Performance.Collection.Rule

Element properties:

TypeProbeActionModuleType
IsolationAny
AccessibilityInternal
RunAsDefault
OutputTypeSystem.PropertyBagData

Member Modules:

ID Module Type TypeId RunAs 
Probe ProbeAction Microsoft.Windows.PowerShellPropertyBagTriggerOnlyProbe Default

Overrideable Parameters:

IDParameterTypeSelectorDisplay NameDescription
TimeoutSecondsint$Config/TimeoutSeconds$Timeout Seconds
UserCredentialstring$Config/UserCredential$UserCredential
UserPasswordstring$Config/UserPassword$UserPassword

Source Code:

<ProbeActionModuleType ID="O365SMP.O365Portal_Login.Performance.Collection.Rule.ProbeActionModuleType" Accessibility="Internal" Batching="false" PassThrough="false">
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="TimeoutSeconds" type="xsd:integer"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="UserCredential" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="UserPassword" type="xsd:string"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int"/>
<OverrideableParameter ID="UserCredential" Selector="$Config/UserCredential$" ParameterType="string"/>
<OverrideableParameter ID="UserPassword" Selector="$Config/UserPassword$" ParameterType="string"/>
</OverrideableParameters>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<ProbeAction ID="Probe" TypeID="Windows!Microsoft.Windows.PowerShellPropertyBagTriggerOnlyProbe">
<ScriptName>CollectMSOLsvc_v1.ps1</ScriptName>
<ScriptBody><Script>
###############################################
#Created by: Ismaen Aboubakare and Brian Zoucha
# Filename: CollectMSOLSvc_v1_5.ps1
# Description: This script tracks the time in ms to connect to the MSOL Service (Office 365)
# Updates: TB-11/7/18 Added success event entry
################################################

#Code for when importing to SCOM to enable user parameters
Param(
[parameter(Mandatory=$true)]
$UserCredential,
[parameter(Mandatory=$true)]
$UserPassword
)

$api = new-object -comObject 'MOM.ScriptAPI'
$bag = $api.CreatePropertyBag()
$Credential = New-Object -TypeName "System.Management.Automation.PSCredential" -ArgumentList $UserCredential, $UserPassword

#Creating empty powershell object
$connectionMetrics = @()

#Getting user Credential and measuring time to connect in Milliseconds. If errors out or user has wrong credentials
#then it will catch and output, unable to connect to MSOL
try{

$msol = Measure-Command{
$Service = Connect-MsolService -Credential $Credential
}
$timeToConnectToMSOL = $msol.Milliseconds
#Write-Host "Time to connect to MSOService $timeToConnectToMSOL ms" -ForegroundColor Cyan
$bag.AddValue(&#x201C;RTTinMS&#x201D;,[Double]$msol.Milliseconds)
$api.LogScriptEvent('HealthService',50,0,"O365 Connection Success: Connection established" )
}
catch{
$connectMSOLError = "Unable to connect to MSOL"
#Write-Host $connectionMSOLError -ForegroundColor Red
$api.LogScriptEvent('HealthService',50,1,"O365 Connection ERROR: $connectMSOLError" )
}

$bag

</Script></ScriptBody>
<Parameters>
<Parameter>
<Name>UserCredential</Name>
<Value>$RunAs[Name="O365SMP.O365.License.Verification.Profile"]/UserName$</Value>
</Parameter>
<Parameter>
<Name>UserPassword</Name>
<Value>$RunAs[Name="O365SMP.O365.License.Verification.Profile"]/Password$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
<StrictErrorHandling>false</StrictErrorHandling>
</ProbeAction>
</MemberModules>
<Composition>
<Node ID="Probe"/>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.PropertyBagData</OutputType>
<TriggerOnly>true</TriggerOnly>
</ProbeActionModuleType>