Repair Domain Join Powershell
I haven t done this for a while but i think this works.
Repair domain join powershell. You may need to run powershell as administrator to avoid access denied errors. Repair the domain trust relationship with test computersecurechannel adam bertram wed jul 26 2017 thu jul 27 2017 active directory powershell 9 if the trust relationship between a workstation and the primary domain failed you can use the test computersecurechannel powershell cmdlet to test and repair the secure channel between the computer and its active directory domain. May 6 2020 sam fisher.
In powershell 3 0 microsoft introducted the cmdlet test computersecurechannel. It s been a long time but today i tried logging into a pc and was greeted with the familiar the trust relationship between this workstation and the primary domain failed. Open powershell and run the following command.
It is not telling from the name but this cmdlet can not only check whether a computer s domain trust is still valid but it can repair it if it is not. Fortunately i was able to log in with the local administrator account and fix the domain trust. Using powershell you can automate this entire process and never leave your desk.
Not exactly a seamless operation especially if the system is remote. To do this just right click the powershell icon and select run as administrator. Extra steps if the machine is a domain controller.
You can also use built in powershell cmdlets to unjoin and join a computer to a domain with powershell. Reset the channel between the local computer and its domain. Join single computer to domain with powershell.
Ps c test computersecurechannel repair true. In the past your option for fixing a computer s trust relationship with the domain was to remove it from the domain reboot re add it to the domain and reboot. Provide the domain credential with permissions to unjoin the computer.