AzStackHci.EnvironmentChecker.Utilities.psm1


Import-Module $PSScriptRoot\AzStackHci.EnvironmentChecker.Reporting.psm1 -Force -DisableNameChecking -Global
Import-LocalizedData -BindingVariable lTxt -FileName AzStackHci.EnvironmentChecker.Strings.psd1

class HealthModel
{
    # Attributes for Azure Monitor schema
    [string]$Name #Name of the individual test/rule/alert that was executed. Unique, not exposed to the customer.
    [string]$Title #User-facing name; one or more sentences indicating the direct issue.
    [string]$Severity #Severity of the result (Critical, Warning, Informational, Hidden) – this answers how important the result is. Critical is the only update-blocking severity.
    [string]$Description #Detailed overview of the issue and what impact the issue has on the stamp.
    [psobject]$Tags #Key-value pairs that allow grouping/filtering individual tests. For example, "Group": "ReadinessChecks", "UpdateType": "ClusterAware"
    [string]$Status #The status of the check running (i.e. Failed, Succeeded, In Progress) – this answers whether the check ran, and passed or failed.
    [string]$Remediation #Set of steps that can be taken to resolve the issue found.
    [string]$TargetResourceID #The unique identifier for the affected resource (such as a node or drive).
    [string]$TargetResourceName #The name of the affected resource.
    [string]$TargetResourceType #The type of resource being referred to (well-known set of nouns in infrastructure, aligning with Monitoring).
    [datetime]$Timestamp #The Time in which the HealthCheck was called.
    [psobject]$AdditionalData #Property bag of key value pairs for additional information.
    [string]$HealthCheckSource #The name of the services called for the HealthCheck (I.E. Test-AzureStack, Test-Cluster).
}

function Test-ModuleUpdate
{
    <#
    .SYNOPSIS
        Checks PSGallery for updated module.
    .DESCRIPTION
        Checks PSGallery for updated module and gives user 10 seconds
        to cancel cmdlet and prints update instructions to screen
    #>

    param([switch]$PassThru)
    try
    {
        if (-not $PassThru)
        {
            Log-Info "Looking for module updates for $($MyInvocation.MyCommand.Module.Name) greater than $($MyInvocation.MyCommand.Module.Version)"
            $ModuleOnline = Find-Module -Name $MyInvocation.MyCommand.Module.Name -Repository PSGallery -AllowPrerelease -ErrorAction SilentlyContinue
            if (([system.version]$ModuleOnline.Version -replace ('-preview', '')) -gt [system.version]$MyInvocation.MyCommand.Module.Version)
            {
                Log-Info ($lTxt.CurrentVersion -f $MyInvocation.MyCommand.Module.Name, $MyInvocation.MyCommand.Module.Version) -ConsoleOut
                Log-Info ($lTxt.UpdateToVersion -f $ModuleOnline.Version, $MyInvocation.MyCommand.Module.Name) -ConsoleOut
                Start-Sleep -Seconds 10
            }
            else
            {
                Log-Info ($lTxt.CurrentVersion -f $MyInvocation.MyCommand.Module.Name, $MyInvocation.MyCommand.Module.Version)
            }
        }
    }
    catch
    {
        Log-Info ($lTxt.Exception -f $MyInvocation.MyCommand.Name, $_.exception.message) -Type Error
    }
}

function Test-IsClusterNode
{
    <#
    .SYNOPSIS
        This is a function to test is the local machine is a cluster node.
    #>

    [CmdletBinding()]
    param(
        [Parameter()]
        [System.Management.Automation.Runspaces.PSSession]
        $PsSession
    )

    $clusSvc = Get-Service -Name ClusSvc -ErrorAction SilentlyContinue
    if ($clusSvc.Status -eq 'Running')
    {
        Log-Info -Message "Cluster service is running on $ENV:ComputerName"
        return $true
    }
    else
    {
        Log-Info -Message "Cluster service is not running on $ENV:ComputerName"
        return $false
    }
}

function Get-ClusterNodeName
{
    <#
    .SYNOPSIS
        Get all Cluster Node names.
    #>

    [CmdletBinding()]
    param (

        [Parameter()]
        [string]
        $Cluster,

        [Parameter()]
        [System.Management.Automation.Runspaces.PSSession]
        $PsSession
    )

    $sb = {
        if ([string]::IsNullOrEmpty($Cluster))
        {
            Get-ClusterNode
        }
        else
        {
            Get-ClusterNode -Cluster $Cluster
        }
    }

    if ([string]::IsNullOrEmpty($PsSession))
    {
        Log-Info -Message "Get cluster node locally on $ENV:ComputerName"
        $nodes = Invoke-Command -ScriptBlock $sb
    }
    else
    {
        Log-Info -Message "Get cluster node from PsSession on $($PsSession.ComputerName)"
        $nodes = Invoke-Command -ScriptBlock $sb -Session $PsSession
    }

    foreach ($node in $nodes)
    {
        if ($node.State -ne 'Up')
        {
            Log-Info -Message "$node state is $($node.state)"
        }
    }
    Log-Info -Message ("Return node names: {0}" -f ($nodes.name -join ','))
    return $nodes.Name
}

function Open-PsSession
{
    <#
    .SYNOPSIS
        Create PsSession to intended targets
    .DESCRIPTION
        Creates PsSession to single computer, cluster and related nodes.
    #>

    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $false, HelpMessage = "Specify the Computer Name(s) to run validation from. If null the local machine will be used.")]
        [string[]]
        $ComputerName,

        [Parameter(Mandatory = $false, HelpMessage = "Specify the Cluster Name to run validation from. If null the local machine will be used.")]
        [string]
        $Cluster,

        [Parameter(Mandatory = $false, HelpMessage = "Specify the credential used to connect to remote computer.")]
        [pscredential]
        $Credential,

        [Parameter(Mandatory = $false, HelpMessage = "Specify the authentication used to connect to remote computer.")]
        $Authentication
    )

    try
    {

        # Build PsSession Params
        $sessionAuthParams = @{}
        if (-not [string]::IsNullOrEmpty($Authentication))
        {
            if ($Authentication -eq 'CredSSP' -and [string]::IsNullOrEmpty($Credential))
            {
                throw "A credential object must be provided with $Authentication Authentication"
            }
            $sessionAuthParams += @{
                Authentication = $Authentication
            }
        }
        if (-not [string]::IsNullOrEmpty($Credential))
        {
            $sessionAuthParams += @{
                Credential = $Credential
            }
        }

        # Check if local machine is a cluster node and get its cluster nodes
        if (Test-IsClusterNode)
        {
            if ([string]::IsNullOrEmpty($Credential))
            {
                Log-Info -Message "Credential not provided. Other Cluster nodes will not have connectivity validated. Only $ENV:ComputerName"
            }
            else
            {
                Log-Info -Message "Get computer names from local cluster/nodes"
                $ComputerName += @(Get-ClusterNodeName)
            }
        }

        # Create PsSession to cluster and get node names
        if (-not [string]::IsNullOrEmpty($Cluster))
        {
            Log-Info -Message "Create session to cluster $cluster"
            $ClusterPsSession = New-PSSession -ComputerName $Cluster @sessionAuthParams

            Log-Info -Message "Get computer names from remote session to cluster $Cluster"
            $ComputerName = Get-ClusterNodeName -PsSession $ClusterPsSession -Cluster $Cluster

            Log-Info -Message ("ComputerNames found {0} from remote session to cluster $cluster. Removing session." -f ($ComputerName -join ','))
            $ClusterPsSession | Remove-PSSession
        }

        if ([string]::IsNullOrEmpty($ComputerName))
        {
            Log-Info -Message ("Running all tests locally.")
        }
        else
        {
            $ComputerName = $ComputerName | Sort-Object | Get-Unique
            Log-Info -Message ("Create a pssession to each ComputerName {0}." -f ($ComputerName -join ','))
            $PsSession = @()
            $PsSession += foreach ($Computer in $ComputerName)
            {
                $Session = New-PSSession -ComputerName $Computer @sessionAuthParams -ErrorAction Stop
                Log-Info -Message ("Create a pssession created to {0}." -f $Session.ComputerName)
            }
            if ($null -eq $Session)
            {
                throw "User specified ComputerName but no remote sessions could be established to $($Computer -join ',')"
            }
            $Session
        }
        return $PsSession
    }
    catch
    {
        $exceptionMsg = $lTxt.Exception -f $MyInvocation.MyCommand.Name, $_.exception.message
        Log-Info $exceptionMsg -Type Error
        throw $exceptionMsg
    }
}

function Open-CimSession
{
    <#
    .SYNOPSIS
        Create PsSession to intended targets
    .DESCRIPTION
        Creates PsSession to single computer, cluster and related nodes.
    #>

    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $false, HelpMessage = "Specify the Computer Name(s) to run validation from. If null the local machine will be used.")]
        [string[]]
        $ComputerName,

        [Parameter(Mandatory = $false, HelpMessage = "Specify the Cluster Name to run validation from. If null the local machine will be used.")]
        [string]
        $Cluster,

        [Parameter(Mandatory = $false, HelpMessage = "Specify the credential used to connect to remote computer.")]
        [pscredential]
        $Credential,

        [Parameter(Mandatory = $false, HelpMessage = "Specify the authentication used to connect to remote computer.")]
        $Authentication
    )

    try
    {

        # Build PsSession Params
        $sessionAuthParams = @{}
        if (-not [string]::IsNullOrEmpty($Authentication))
        {
            if ($Authentication -eq 'CredSSP' -and [string]::IsNullOrEmpty($Credential))
            {
                throw "A credential object must be provided with $Authentication Authentication"
            }
            $sessionAuthParams += @{
                Authentication = $Authentication
            }
        }
        if (-not [string]::IsNullOrEmpty($Credential))
        {
            $sessionAuthParams += @{
                Credential = $Credential
            }
        }

        # Check if local machine is a cluster node and get its cluster nodes
        if (Test-IsClusterNode)
        {
            if ([string]::IsNullOrEmpty($Credential))
            {
                Log-Info -Message "Credential not provided. Other Cluster nodes will not have connectivity validated. Only $ENV:ComputerName"
            }
            else
            {
                Log-Info -Message "Get computer names from local cluster/nodes"
                $ComputerName += @(Get-ClusterNodeName)
            }
        }

        # Create PsSession to cluster and get node names
        if (-not [string]::IsNullOrEmpty($Cluster))
        {
            Log-Info -Message "Create session to cluster $cluster"
            $ClusterPsSession = New-PSSession -ComputerName $Cluster @sessionAuthParams

            Log-Info -Message "Get computer names from remote session to cluster $Cluster"
            $ComputerName = Get-ClusterNodeName -PsSession $ClusterPsSession -Cluster $Cluster

            Log-Info -Message ("ComputerNames found {0} from remote session to cluster $cluster. Removing session." -f ($ComputerName -join ','))
            $ClusterPsSession | Remove-PSSession
        }

        if ([string]::IsNullOrEmpty($ComputerName))
        {
            Log-Info -Message ("Running all tests locally.")
            $CimSession = New-CimSession -ComputerName $ENV:COMPUTERNAME
        }
        else
        {
            $ComputerName = $ComputerName | Sort-Object | Get-Unique
            Log-Info -Message ("Create a CimSession to each ComputerName {0}." -f ($ComputerName -join ','))
            $CimSession = @()
            $CimSession += foreach ($Computer in $ComputerName)
            {
                $Session = New-CimSession -ComputerName $Computer @sessionAuthParams -ErrorAction Stop
                Log-Info -Message ("Create a CimSession created to {0}." -f $Session.ComputerName)
            }
            if ($null -eq $Session)
            {
                throw "User specified ComputerName but no remote sessions could be established to $($Computer -join ',')"
            }
            $Session
        }
        return $CimSession
    }
    catch
    {
        $exceptionMsg = $lTxt.Exception -f $MyInvocation.MyCommand.Name, $_.exception.message
        Log-Info $exceptionMsg -Type Error
        throw $exceptionMsg
    }
}

function Test-Elevation
{
    ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')
}

function Test-Count
{
    [CmdletBinding()]
    param (
        [CimInstance[]]
        $CimData,

        [int]
        $minimum,

        [string]
        $ValidatorName,

        [validateset('Critical','Warning','Informational','Hidden')]
        [string]
        $Severity
    )
    try
    {
        $passed = $false
        $className = $CimData.CimSystemProperties.ClassName -split '_' | Select-Object -Last 1
        $instanceId = $CimData.CimSystemProperties.ServerName | Sort-Object | Get-Unique

        if ($CimData.Count -lt $minimum)
        {
            $passed = $false
            $detail = $lTxt.MinCount -f $ClassName, $CimData.count, $minimum
        }
        else
        {
            $passed = $true
        }

        $result = New-Object HealthModel
        $Result.Name = 'AzStackHci_{0}_Test_{1}_Count' -f $ValidatorName, $className
        $Result.Title = 'Test {0} Count' -f $className
        $Result.Severity = $Severity
        $Result.Description = 'Checking {0} count' -f $className
        $Result.Remediation = 'https://aka.ms/hci-connect-chk'
        $Result.TargetResourceID = $InstanceId
        $Result.TargetResourceName = $InstanceId
        $Result.TargetResourceType = $className
        $Result.Timestamp = [datetime]::UtcNow
        $Result.HealthCheckSource = 'Environment Checker'
        $Result.AdditionalData = New-Object -TypeName PSObject -Property @{
            Source    = "$ClassName Count"
            Resource  = $CimData.count
            Detail    = $detail
            Status    = if ($passed) { 'Succeeded' } else { 'Failed' }
            TimeStamp = [datetime]::UtcNow
        }
        $result.Status = if ($passed) { 'Succeeded' } else { 'Failed' }
        $result
    }
    catch
    {
        throw $_
    }
}

function Test-InstanceCountByGroup
{
    <#
    .SYNOPSIS
        Test if count matches across groups
    #>

    [CmdletBinding()]
    param (
        [CimInstance[]]
        $CimData,

        [string[]]
        $GroupProperty,

        [validateset('Critical','Warning','Informational','Hidden')]
        [string]
        $Severity
    )
    try
    {
        $GroupValues = $cimData | Group-Object -Property $groupProperty | Select-Object -ExpandProperty Name
        $nodeCount = ($cimData.CimSystemProperties.ServerName | Sort-Object | Get-Unique).count
        foreach ($GroupValue in $GroupValues)
        {
            foreach ($group in $GroupProperty)
            {
                $gData = $CimData | Where-Object $Group -eq $GroupValue
                if ($gData.CimSystemProperties.SystemName.Count -eq 1)
                {
                    $serverName = $gData.CimSystemProperties.SystemName
                }
                else
                {
                    $serverName = 'AllServers'
                }

                $className = $gData.CimSystemProperties.ClassName -split '_' | Select-Object -Last 1

                $result = New-Object HealthModel
                $result.Name = 'AzStackHci_{0}_Test_{1}_Instance_Count_ByGroup' -f $ValidatorName, $className
                $result.Title = 'Test {0} Properties' -f $className
                $result.Severity = $Severity
                $result.Description = 'Checking all servers have same {0} instance count by group' -f $className
                $result.Remediation = 'https://aka.ms/hci-connect-chk'
                $result.TargetResourceID = "{0}.All{1}" -f $ServerName, $className
                $result.TargetResourceName = "{0}.All{1}" -f $ServerName, $className
                $result.TargetResourceType = $className
                $result.Timestamp = [datetime]::UtcNow
                $result.HealthCheckSource = 'Environment Checker'

                $groupData = $gData | Group-Object { $_.CimSystemProperties.ServerName } | Select-Object *, @{label = 'InstanceCount'; e = { $_.count } }
                $groupDataCount = $groupData.InstanceCount | Sort-Object | Get-Unique
                # The count of InstanceCounts must equal the number of servers to ensure each server has at least 1 instance
                # e.g. SVR1 has 6 disks of type A, SVR has 6 disks of type A, but SVR3 could have 5 disks of type A.
                # There should be only 1 unique InstanceCount from all values to ensure each server has the same instance count
                # e.g. SVR1 has 6 disks of type A, SVR has 6 disks of type A, SVR3 has 6 disks of type A.
                $Status = if ($groupData.InstanceCount.Count -ne $nodeCount -or $groupDataCount.Count -gt 1 ) { 'Failed' } else { 'Succeeded' }
                $result.AdditionalData = New-Object -TypeName PSObject -Property @{
                    Source    = $serverName
                    Resource  = $ClassName
                    Detail    = if ($status -eq 'Succeeded') {
                        $lTxt.CountByGroup -f $Group
                    }
                    else {
                        $lTxt.CountByGroupFail -f $group, `
                        (($groupData | ForEach-Object { "{0}: {1}: $Group`: {2}" -f $_.Name, $_.InstanceCount, $GroupValue }) -join ',')
                    }
                    Status    = $Status
                    TimeStamp = [datetime]::UtcNow
                }
                $result.Status = if ($result.AdditionalData.Status -contains 'Failed') { 'Failed' } else { 'Succeeded' }
                $result
            }
        }
    }
    catch
    {
        throw $_
    }
}

function Test-GroupProperty
{
    <#
    .SYNOPSIS
        Test if properties match across groups
    #>

    [CmdletBinding()]
    param (
        [CimInstance[]]
        $CimData,

        [string[]]
        $GroupProperty,

        [string[]]
        $MatchProperty,

        [string]
        $ValidatorName,

        [validateset('Critical','Warning','Informational','Hidden')]
        [string]
        $Severity
    )
    try
    {
        # Group by name and compare properties within each group
        $className = $CimData.CimSystemProperties.ClassName -split '_' | Select-Object -Last 1
        $ServerName = $CimData.CimSystemProperties.ServerName | Sort-Object | Get-Unique
        $groupedData = @($CimData | Group-Object -Property $groupProperty)
        $returnResult = @()
        if ($serverName.Count -gt 1)
        {
            $serverName = 'AllServers'
        }
        $returnResult += foreach ($group in $groupedData)
        {
            $instanceId = "Machine: {0}, Class: {1} Group: {2}" -f $ServerName, $className, $group.Name

            $result = New-Object HealthModel
            $result.Name = 'AzStackHci_{0}_Test_{1}_Group_Consistency' -f $ValidatorName, $className
            $result.Title = 'Test {0} Groups' -f $className
            $result.Severity = $Severity
            $result.Description = 'Checking {0} Groups for consistent properties' -f $className
            $result.Remediation = 'https://aka.ms/hci-connect-chk'
            $result.TargetResourceID = $instanceId
            $result.TargetResourceName = $instanceId
            $result.TargetResourceType = $className
            $result.Timestamp = [datetime]::UtcNow
            $result.HealthCheckSource = 'Environment Checker'
            $AdditionalData = @()

            $detail = $null
            $passed = $false
            if ($group.Count -gt 1)
            {
                foreach ($propertyName in $matchProperty)
                {
                    if (($group.Group.$propertyName | Sort-Object | Get-Unique).Count -gt 1)
                    {
                        $passed = $false
                        $detail = $lTxt.MismatchProp -f $className, $propertyName, ($group.Group.$propertyName -join ', ')
                        Log-Info -Message $detail -Type Warning
                    }
                    else
                    {
                        $passed = $true
                    }
                    $AdditionalData += New-Object -TypeName PSObject -Property @{
                        Source    = "$($Group.Name) $propertyName"
                        Resource  = $instance.$propertyName
                        Detail    = $detail
                        Status    = if ($passed) { 'Succeeded' } else { 'Failed' }
                        TimeStamp = [datetime]::UtcNow
                    }
                }
            }
            $result.AdditionalData = $AdditionalData
            $result.Status = if ($AdditionalData.Status -contains 'Failed') { 'Failed' } else { 'Succeeded' }
            $result
        }
        $returnResult
    }
    catch
    {
        throw $_
    }
}

function Test-InstanceCount
{
    <#
    .SYNOPSIS
        Test if instance count matches across instances
    #>

    [CmdletBinding()]
    param (
        [Parameter()]
        [CimInstance[]]
        $CimData,

        [validateset('Critical','Warning','Informational','Hidden')]
        [string]
        $Severity
    )
    if ($CimData.CimSystemProperties.SystemName.Count -eq 1)
    {
        $serverName = $CimData.CimSystemProperties.SystemName
    }
    else
    {
        $serverName = 'AllServers'
    }

    $className = $CimData.CimSystemProperties.ClassName -split '_' | Select-Object -Last 1

    $result = New-Object HealthModel
    $result.Name = 'AzStackHci_{0}_Test_{1}_Instance_Count' -f $ValidatorName, $className
    $result.Title = 'Test {0} Properties' -f $className
    $result.Severity = $Severity
    $result.Description = 'Checking all servers have same {0} instance count' -f $className
    $result.Remediation = 'https://aka.ms/hci-connect-chk'
    $result.TargetResourceID = "{0}.All{1}" -f $ServerName, $className
    $result.TargetResourceName = "{0}.All{1}" -f $ServerName, $className
    $result.TargetResourceType = $className
    $result.Timestamp = [datetime]::UtcNow
    $result.HealthCheckSource = 'Environment Checker'

    $groupData = $cimData | Group-Object { $_.CimSystemProperties.ServerName } | Select-Object *, @{label = 'InstanceCount'; e = { $_.count } }
    $groupDataCount = $groupData.InstanceCount | Sort-Object | Get-Unique
    $status = if ($groupDataCount.Count -gt 1) { 'Failed' } else { 'Succeeded' }
    $result.AdditionalData = New-Object -TypeName PSObject -Property @{
        Source    = $serverName
        Resource  = $ClassName
        Detail    = if ($status -eq 'Succeeded') {
            $lTxt.InstanceCount
        }
        else {
            $lTxt.InstanceCountFail -f `
            (($groupData | ForEach-Object { "{0}: {1}" -f $_.Name, $_.InstanceCount }) -join ',')
        }
        Status    = $status
        TimeStamp = [datetime]::UtcNow
    }
    $result.Status = if ($result.AdditionalData.Status -contains 'Failed') { 'Failed' } else { 'Succeeded' }
    $result
}

function Test-PropertySync
{
    <#
    .SYNOPSIS
        Test if properties match across instances
    #>


    [CmdletBinding()]
    param (
        [Parameter()]
        [CimInstance[]]
        $CimData,

        [Parameter()]
        [string[]]
        $MatchProperty,

        [string]
        $ValidatorName,

        [validateset('Critical','Warning','Informational','Hidden')]
        [string]
        $Severity
    )
    try
    {
        $returnResult = @()
        $className = $CimData.CimSystemProperties.ClassName -split '_' | Select-Object -Last 1
        $serverName = $CimData.CimSystemProperties.ServerName | Sort-Object | Get-Unique
        if ($serverName.Count -gt 1)
        {
            $serverName = 'AllServers'
            $returnResult += Test-InstanceCount -CimData $CimData
        }
        $returnResult += if ($CimData.Count -gt 1)
        {
            $result = New-Object HealthModel
            $result.Name = 'AzStackHci_{0}_Test_{1}_Consistency' -f $ValidatorName, $className
            $result.Title = 'Test {0} Properties' -f $className
            $result.Severity = $Severity
            $result.Description = 'Checking all {0} for consistent properties' -f $className
            $result.Remediation = 'https://aka.ms/hci-connect-chk'
            $result.TargetResourceID = "{0}.All{1}" -f $ServerName, $className
            $result.TargetResourceName = "{0}.All{1}" -f $ServerName, $className
            $result.TargetResourceType = $className
            $result.Timestamp = [datetime]::UtcNow
            $result.HealthCheckSource = 'Environment Checker'
            $AdditionalData = @()

            foreach ($propertyName in $matchProperty)
            {
                $detail = $null
                $passed = $false
                if (($CimData.$propertyName | Get-Unique).Count -gt 1)
                {
                    $passed = $false
                    $detail = $lTxt.MismatchProp -f $className, $propertyName, ($CimData.$propertyName -join ',')
                    Log-Info -Message $detail -Type Warning
                }
                else
                {
                    $passed = $true
                }
                $AdditionalData += New-Object -TypeName PSObject -Property @{
                    Source    = "$className`: $propertyName"
                    Resource  = $instance.$propertyName
                    Detail    = $detail
                    Status    = if ($passed) { 'Succeeded' } else { 'Failed' }
                    TimeStamp = [datetime]::UtcNow
                }
            }
            $result.AdditionalData = $AdditionalData
            $result.Status = if ($AdditionalData.Status -contains 'Failed') { 'Failed' } else { 'Succeeded' }
            $result
        }
        return $returnResult
    }
    catch
    {
        throw $_
    }
}

function Test-DesiredProperty
{
    <#
    .SYNOPSIS
        Test if properties have required value
    #>

    [cmdletbinding()]
    param (
        [CimInstance[]]
        $cimData,

        [hashtable]
        $desiredPropertyValue,

        [string]
        $InstanceIdStr,

        [string]
        $ValidatorName,

        [validateset('Critical','Warning','Informational','Hidden')]
        [string]
        $Severity
    )

    try
    {
        # Test properties
        $returnResult = @()
        $returnResult += foreach ($instance in $cimData)
        {
            $serverName = $instance.CimSystemProperties.ServerName | Sort-Object | Get-Unique
            $sb = ([scriptblock]::Create($InstanceIdStr))
            $instanceId = Invoke-Command -ScriptBlock $sb
            $className = $instance.CimSystemProperties.ClassName -split '_' | Select-Object -Last 1
            Log-Info -Message ($lTxt.Test -f $className, $instanceId)

            $result = New-Object HealthModel
            $result.Name = 'AzStackHci_{0}_Test_{1}_Instance_Properties' -f $ValidatorName, $className
            $result.Title = 'Test {0} Properties' -f $className
            $result.Severity = $Severity
            $result.Description = 'Checking {0} for desired properties' -f $className
            $result.Remediation = 'https://aka.ms/hci-connect-chk'
            $result.TargetResourceID = $instanceId
            $result.TargetResourceName = $instanceId
            $result.TargetResourceType = $className
            $result.Timestamp = [datetime]::UtcNow
            $result.HealthCheckSource = 'Environment Checker'
            $AdditionalData = @()

            foreach ($propertyName in $desiredPropertyValue.Keys)
            {
                $detail = $null
                $passed = $false
                $hint = $null
                $desiredPropertyValueCheck = $null
                $desiredPropertyValueCheck = if ($desiredPropertyValue.$propertyName -is [hashtable])
                {
                    $desiredPropertyValue.$propertyName.Value
                }
                else
                {
                    $desiredPropertyValue.$propertyName
                }

                if (($instance.$propertyName | Select-Object -First 1) -notin $desiredPropertyValueCheck)
                {
                    $passed = $false
                    $hint = if ($desiredPropertyValue.$propertyName.hint) { ' ({0})' -f $desiredPropertyValue.$propertyName.hint }
                    $detail = $lTxt.UnexProp -f $className, $propertyName, $instance.$propertyName, ($desiredPropertyValueCheck -join ','), $hint
                    Log-Info -Message $detail -Type Warning
                }
                else
                {
                    $passed = $true
                }
                $AdditionalData += New-Object -TypeName PSObject -Property @{
                    Source    = "$className`: $propertyName"
                    Resource  = if ($hint) { "$($instance.$propertyName)$hint" } else { $instance.$propertyName }
                    Detail    = $detail
                    Status    = if ($passed) { 'Succeeded' } else { 'Failed' }
                    TimeStamp = [datetime]::UtcNow
                }
            }

            $result.AdditionalData = $AdditionalData
            $result.Status = if ($AdditionalData.Status -contains 'Failed') { 'Failed' } else { 'Succeeded' }
            $result
        }
        return $returnResult
    }
    catch
    {
        throw $_
    }
}

function Confirm-RemoteConnectionMatch
{
    <#
    .SYNOPSIS
        Ensure multiple remote connection methods match all remote systems
    #>

    [CmdletBinding()]
    param (
        [Parameter()]
        [System.Management.Automation.Runspaces.PSSession[]]
        $PsSession,

        [CimSession[]]
        $CimSession
    )

    if ($PsSession -or $CimSession)
    {
        Log-Info ($lTxt.RemoteSyncStart -f ($PsSession.ComputerName -join ','), ($CimSession.ComputerName -join ','))
        if (Compare-Object -ReferenceObject $PsSession -DifferenceObject $CimSession -Property ComputerName)
        {
            $errorMsg = $lTxt.RemoteSyncFail -f ($PsSession.ComputerName -join ','), ($CimSession.ComputerName -join ',')
            Log-Info $errorMsg -Type Error
            throw $errorMsg
        }
        else
        {
            Log-Info ($lTxt.RemoteSyncPass -f ($PsSession.ComputerName -join ','), ($CimSession.ComputerName -join ','))
        }
    }
    else
    {
        Log-Info $lTxt.RemoteSyncSkip
    }
}

function Get-TestCount
{
    param (
        [Parameter()]
        [string]
        $ModuleName,

        [Parameter()]
        [string]
        $CommandPrefix
    )
    try
    {
        $command = Get-Command -Name $CommandPrefix* -Module $ModuleName
        if ($command)
        {
            return $command.Count
        }
        else
        {
            return 1
        }
    }
    catch
    {
        return 1
    }
}

function Get-DeploymentData
{
    [cmdletbinding()]
    param ($Path)

    try
    {
        $Json = Get-Content -Path $Path | ConvertFrom-Json
        $DeploymentData = $json.ScaleUnits[0].DeploymentData
        if ([string]::IsNullOrEmpty($DeploymentData))
        {
            Log-Info $lTxt.InvalidDeploymentData
            return $null
        }
        return $DeploymentData
    }
    catch
    {
        throw $_
    }
}
# SIG # Begin signature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