Skip to main content
Skip table of contents

Troubleshooting on Multiple Devices

This documentation is still Draft and improving. DO NOT TAKE ANY ACTIONS if you don’t know what to do!

Find Virtual Smartcard Status on Devices / Or Device List on Active Directory

POWERSHELL
$Computers = Get-ADComputer -Filter { Name -like "MONOCLIENT01" -or Name -like "MONOCLIENT02" -or Name -like "MONOCLIENT04" } -Properties *

$UserName = "AD-USER"
$Password = "DONT-TYPE-PASSWORD-IF-YOU-WANT-TO-TYPE-IT-SECURE"

if($UserName -ne "") {
    if ($Password -eq "") {
        $__monoPamCredential = Get-Credential -Credential $UserName
    }
    else {
        $__monoPamPassword = ConvertTo-SecureString $Password -AsPlainText -Force
        $__monoPamCredential = New-Object System.Management.Automation.PSCredential($UserName, $__monoPamPassword)
    }
}

$Result = New-Object System.Collections.ArrayList
$Count = $Computers.Count
$Counter = 0
foreach ($Computer in $Computers) {
    $Counter = $Counter + 1
    $ResultStatus = New-Object PSObject
    $ResultStatus | Add-Member -MemberType NoteProperty -Name "ComputerName" -Value $Computer.Name

    $IsAvailable = "Unknown"

    Write-Host "[$Counter/$Count] Checking status of $($Computer.Name)"
    $GeneralStatus = Invoke-Command -ComputerName $Computer.Name -ScriptBlock {
        # Get-TPM Status of Machine
        $TpmStatus = "Unknown"
        
        # Get-SmartCard Status of MONOFOR-TPM
        $MonoforTpmStatus = "Unknown"

        $Client = New-Object PSObject
        $Tpm = Get-Tpm
        if($Tpm.TpmPresent -eq $true -and $Tpm.TpmReady -eq $true -and $Tpm.TpmEnabled -eq $true -and $Tpm.TpmActivated -eq $true)
        {
            $TpmStatus = "Active"
        }

        if($TpmStatus -eq "Active")
        {
            $TpmDevices = Get-PnpDevice | Where-Object { $_.Class -eq 'SmartCardReader' -and $_.FriendlyName -eq "MONOFOR-TPM" -and $_.Status -eq "OK" }
            if($TpmDevices)
            {
                $MonoforTpmStatus = "Active"
            }
        }

        $Client | Add-Member -MemberType NoteProperty -Name "TPM" -Value $TpmStatus
        $Client | Add-Member -MemberType NoteProperty -Name "MonoforTPM" -Value $MonoforTpmStatus

        $Client
    } -Credential $__monoPamCredential

    if($GeneralStatus.TPM -eq "Active" -and $GeneralStatus.MonoforTPM -eq "Active")
    {
        $IsAvailable = "Yes"
    }

    if($null -eq $GeneralStatus)
    {
        $IsAvailable = "Unreachable"
    }

    $ResultStatus | Add-Member -MemberType NoteProperty -Name "Available" -Value $IsAvailable
    $ResultStatus | Add-Member -MemberType NoteProperty -Name "TPM" -Value $GeneralStatus.TPM
    $ResultStatus | Add-Member -MemberType NoteProperty -Name "MonoforTPM" -Value $GeneralStatus.MonoforTPM

    $Result.Add($ResultStatus) | Out-Null
}

$Result

Example Result

POWERSHELL
[1/3] Checking status of MONOCLIENT01
[2/3] Checking status of MONOCLIENT02
[3/3] Checking status of MONOCLIENT04

ComputerName Available   TPM     MonoforTPM
------------ ---------   ---     ----------
MONOCLIENT01 Unreachable                   
MONOCLIENT02 Unknown     Unknown Unknown   
MONOCLIENT04 Yes         Active  Active
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.