Hi,
You can easily check all computers in AD on a regular schedule and generate a report by using the AD PowerShell module, a loop, and the Test-ComputerSecureChannel command.
$localCredential = Get-Credential
@(Get-AdComputer -Filter *).foreach({
$output = @{ ComputerName = $_.Name }
if (-not (Test-Connection -ComputerName $_.Name -Quiet -Count 1)) { $output.Status = 'Offline'
} else {
$trustStatus = Invoke-Command -ComputerName $_.Name -ScriptBlock { Test-ComputerSecureChannel } -Credential $localCredential
$output.Status = $trustStatus
}
[pscustomobject]$output
})
Running this returns an output that looks like this:
ComputerName Status
COMPUTER1 Offline
COMPUTER2 True
COMPUTER3 False
COMPUTER4 True
Plus, you can get more information by visiting the link:
https://theitbros.com/fix-trust-relationship-failed-without-domain-rejoining/
https://4sysops.com/archives/repair-the-domain-trust-relationship-with-test-computersecurechannel/
Hope these can help you.
best wishes,
Young Yang