Logical Disk Data Source Module

Microsoft.Windows.Server.10.0.LogicalDisk.ModuleType (DataSourceModuleType)

Element properties:

TypeDataSourceModuleType
IsolationAny
AccessibilityInternal
RunAsSystem.PrivilegedMonitoringAccount
OutputTypeSystem.PropertyBagData

Member Modules:

ID Module Type TypeId RunAs 
Scheduler DataSource System.Scheduler Default
PA ProbeAction Microsoft.Windows.Server.10.0.PowerShellPropertyBagProbe Default

Overrideable Parameters:

IDParameterTypeSelectorDisplay NameDescription
IntervalSecondsint$Config/IntervalSeconds$Interval secondsHow frequently (in seconds) the value should be sampled.
TimeoutSecondsint$Config/TimeoutSeconds$Timeout Seconds

Source Code:

<DataSourceModuleType ID="Microsoft.Windows.Server.10.0.LogicalDisk.ModuleType" RunAs="System!System.PrivilegedMonitoringAccount" Accessibility="Internal">
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="IntervalSeconds" type="xsd:int"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="TargetComputerName" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="TimeoutSeconds" type="xsd:int"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int"/>
<OverrideableParameter ID="TimeoutSeconds" ParameterType="int" Selector="$Config/TimeoutSeconds$"/>
</OverrideableParameters>
<ModuleImplementation>
<Composite>
<MemberModules>
<DataSource ID="Scheduler" TypeID="System!System.Scheduler">
<Scheduler>
<SimpleReccuringSchedule>
<Interval>$Config/IntervalSeconds$</Interval>
<SyncTime/>
</SimpleReccuringSchedule>
<ExcludeDates/>
</Scheduler>
</DataSource>
<ProbeAction ID="PA" TypeID="Microsoft.Windows.Server.10.0.PowerShellPropertyBagProbe">
<ScriptName>Microsoft.Windows.Server.LogicalDiskHealthCheck.ps1</ScriptName>
<PSparam>param ($TargetComputer)</PSparam>
<ScriptBody><Script>
#Copyright (c) Microsoft Corporation. All rights reserved.

# Parameters that should be passed to this script
# 0 Computer (FQDN)

Function Main()
{

$IsNano = Is_NanoServer
$IsVolumeInfoSupported = Is_Win32_Volume_Supported $TargetComputer
$states = @{$false = "OK"; $true = "BAD"}
$oVolumes = Get-Volumes -IsNano $IsNano -IsVolumeSupported $IsVolumeInfoSupported -TargetComputer $TargetComputer

foreach ($oVolume in $oVolumes)
{
$VolumeId = Get-VolumeId -IsNano $IsNano -IsVolumeSupported $IsVolumeInfoSupported -Volume $oVolume

if ($false -eq [string]::IsNullOrEmpty($VolumeId) )
{
if ($false -eq $IsNano)
{
$DirtyBitSet = -Not([string]::IsNullOrEmpty($oVolume.DirtyBitSet))
if ($true -eq $DirtyBitSet)
{
$DirtyBitSet = $oVolume.DirtyBitSet
}
}
else
{
#Change for Test Monitor on Nano. -Not was removed
$DirtyBitSet = -Not ($oVolume.HealthStatus -ieq "Healthy")
}

$State = $states[$DirtyBitSet]

Create-State -VolumeId $VolumeId -State $State -momAPI $momAPI
}
}

Unload-Module -ModuleName "Storage"
}

Function Create-State([string]$VolumeId,[string]$State,$momAPI)
{
$ErrorActionPreference="SilentlyContinue"
$error.Clear()

if ($null -eq $momAPI)
{
return
}

$oBag = $momAPI.CreatePropertyBag()
$oBag.AddValue("DiskLabel", $VolumeId)
$oBag.AddValue("State", $State)

if ($error.Count -eq 0)
{
$oBag
}
}



Main
</Script></ScriptBody>
<Parameters>
<Parameter>
<Name>TargetComputer</Name>
<Value>$Config/TargetComputerName$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
</ProbeAction>
</MemberModules>
<Composition>
<Node ID="PA">
<Node ID="Scheduler"/>
</Node>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.PropertyBagData</OutputType>
</DataSourceModuleType>