Windows/Powershell: How to find a Windows Server/Desktop trust with a domain controller

Created: 1-3-21

Updated: 1-3-21

This a very useful command that I’m using all the time for checking which DC a desktop or server is pinned too for domain trust. Finding if very useful for honing in on DC that are tombstoned or giving out stall records to desktops:

nltest /sc_query:domain.suffix

Other useful commands  that tests if a remote server has a specific port open:

Test-NetConnection -computername <serverIP> -Port <port>

Also a recently used powershell command that was quite useful for restart computers remote based on a common computer name for computer in a department:

get-adcomputer -filter ‘Name -like “SF-HR*”‘ | foreach {restart-computer $_.name -force}