Guarded Fabric Connection Monitor PowerShell property bag probe module

Microsoft.Windows.GuardedFabric.10.0.GuardedHostConnectionMonitor.PowerShellPropertyBagProbe (ProbeActionModuleType)

Element properties:

TypeProbeActionModuleType
IsolationAny
AccessibilityInternal
RunAsDefault
InputTypeSystem.BaseData
OutputTypeSystem.PropertyBagData

Member Modules:

ID Module Type TypeId RunAs 
PSScript ProbeAction Microsoft.Windows.PowerShellPropertyBagProbe Default

Source Code:

<ProbeActionModuleType ID="Microsoft.Windows.GuardedFabric.10.0.GuardedHostConnectionMonitor.PowerShellPropertyBagProbe" Accessibility="Internal">
<Configuration/>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<ProbeAction ID="PSScript" TypeID="Windows!Microsoft.Windows.PowerShellPropertyBagProbe">
<ScriptName>ClientConnectionMonitor.ps1</ScriptName>
<ScriptBody><Script>param ()
$testSuccess = $true
# Get current information about HgsClient
$info = Get-HgsClientConfiguration
$api = New-Object -ComObject 'MOM.ScriptAPI'
$bag = $api.CreatePropertyBag()

if ($info.Mode -ne $null)
{
if($info.Mode.ToString() -ieq "HostGuardianService")
{
if($info.KeyProtectionServerUrl.StartsWith("https"))
{
$kdsURL = $info.KeyProtectionServerUrl -replace "https://", ""
}
else
{
$kdsURL = $info.KeyProtectionServerUrl -replace "http://", ""
}
$kdsURL = $kdsURL -replace "/KeyProtection", ""
if($kdsURL.Contains("/"))
{
$kdsURL = $kdsURL.Replace("/","")
}

#do the same for the Attestation URL
if($info.AttestationServerUrl.StartsWith("https"))
{
$attestationURL = $info.AttestationServerUrl -replace "https://", ""
}
else
{
$attestationURL = $info.AttestationServerUrl -replace "http://", ""
}
$attestationURL = $attestationURL -replace "/Attestation", ""
if($attestationURL.Contains("/"))
{
$attestationURL = $attestationURL.Replace("/","")
}


try
{
if($info.KeyProtectionServerUrl.StartsWith("https"))
{
Test-NetConnection -ComputerName $kdsURL -ErrorAction Stop -Port 443
}
else
{
Test-Connection -ComputerName $kdsURL -ErrorAction Stop
}
if($info.AttestationServerUrl.StartsWith("https"))
{
Test-NetConnection -ComputerName $attestationURL -ErrorAction Stop -Port 443
}
else
{
Test-Connection -ComputerName $attestationURL -ErrorAction Stop
}
}
catch [Exception]
{
$testSuccess = $false
}
}
}

$bag.AddValue("Result", $testSuccess)
$bag</Script></ScriptBody>
<TimeoutSeconds>120</TimeoutSeconds>
</ProbeAction>
</MemberModules>
<Composition>
<Node ID="PSScript"/>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.PropertyBagData</OutputType>
<InputType>System!System.BaseData</InputType>
</ProbeActionModuleType>