Have a test VM or any machine that has been offline for too long and getting the "The trust relationship between this workstation and the primary domain failed" error?

If you can get into a local admin account you can run this command to fix it without having to rejoin the computer.  You can also login to the Domain Admin account on the machine if you unplug it from the network.

netdom.exe resetpwd /s:<server> /ud:<user> /pd:*

<server> = a domain controller in the joined domain
<user> = DOMAIN\User format with rights to change the computer password