How many times have you been in the situation where you find that the Windows Server or Workstation has its security relationship with the domain failed.
The usual error you might receive is: “The trust relationship between the workstation and the primary domain failed”.
Now in the past (not so much of a problem for workstations), but you’d have to remove the machine from the domain, reboot, and then re-join the machine and again reboot. Fine for most workstations, but when it comes to servers the process can take (or seem like) it takes forever.
To be fair, even some workstations can take an age to reboot, so to have to do it twice can be a real pain.
However, I recently came across a cheeky little PowerShell command you can issue to rejoin a computer to the domain without restarting it.
Test-ComputerSecureChannel is where it starts, if we run it on a machine which is quite happy on the domain you will receive the below:
The cmdlet by itself checks whether the relationship with the domain controller is still good. If it comes back True then everything is okay. If it comes back False then the relationship needs to be fixed.
Using Test-ComputerSecureChannel with the –credential –Repair options allows you to repair the relationship with the domain without any restarts. You run the command, sign out and then can sign in with your domain credentials.
For example, to repair the relationship with the MRICCIONI domain, issue the command:
Test-ComputerSecureChannel –credential MRICCIONI\Administrator –Repair
When signed on as a local administrator, and that’s that…