netdom resetpwd /s:<dns domainname> /ud:<NETBIOS DOMAINNAME>\<username> /pd:<password>
This is an example script which you can use to automatically fix a trust with the domain when it's lost. Create a scheduled tasks to run this script every 5 minutes
CALL :GO>"C:\FIX_TRUST.log" 2>&1
:GO
NLTEST /SC_VERIFY:<dns domainname> | FIND /I "ERROR_ACCESS_DENIED"
IF %ERRORLEVEL%==0 GOTO FIXTRUST
GOTO END:FIXTRUST
ECHO Running FIXTRUST Script
ECHO OFF
netdom resetpwd /s:<dns domainname> /ud:<NETBIOS DOMAINNAME>\<username> /pd:<password>
SHUTDOWN /R /T 60:END
exit