Attaching DPM 2019 agent gives error 0x800706fd

While finally getting round to replacing a DPM server with a newer DPM server I was moving agents to the new machine and got an error. Just for reference I will put the process down here as well in basic steps and where I ran into the error and what solved it.

Moving the DPM agent to another server:

On the old DPM server, stop protection of the workloads of that agent.

On the old DPM server go to agent management and click Disable Protection for that agent.

On the DPM agent start an elevated command prompt and go to:

C:\Program Files\Microsoft Data Protection Manager\DPM\bin

  SetDpmServer.exe -DpmServerName <newdpmservernamehere>

Now in my case I got an error:

SetDpmServer failed with errorcode =0x800706fd, error says: The trust relationship between this workstation and the primary domain failed.

The way to fix it is this:

Check on that agent machine if the Netlogon service is running. If not, make it run. And run the command prompt thing again for the agent.

After this step is on the new DPM server to add the agent and select the Attach method.

And of course setup protection again of the required workload.

 

Good luck!