When you install AD on a machine you get the MicrosoftActiveDirectory WMI namespace as well. This namespace was deprecated in Windows 2012 but while it is still available there are few useful things we can do with it. Even with my fondness of WMI I’m not suggesting moving to using WMI wholesale for AD admin but one of the more useful things is testing a trust’s status.
PS> Get-CimInstance -ClassName Microsoft_DomainTrustStatus -Namespace root\MicrosoftActiveDirectory |
select Flatname, Trust*
Flatname : SPHINX
TrustAttributes : 8
TrustDirection : 3
TrustedDomain : sphinx.org
TrustIsOk : False
TrustStatus : 1355
TrustStatusString : The specified domain either does not exist or could not be contacted.
TrustType : 2
The error messages are because the VM hosting the remote domain is switched off. If you want a quick test of your trust status this is a good way.