Visual Studio Team Services (VSTS) makes it easy to run nightly builds and releases by using build agents for such tasks.
But what to do if you want to remove ("unconfigure") a build agent from one maschine and forgot to keep the PAT (Personal access token) used to configure this agent?
VSTS does not allow you to see a PAT within the security page (https://INSTANCE.visualstudio.com/_details/security/tokens).
It shows the following:
PS C:\agent> .\config.cmd remove
Removing agent from the server
Enter authentication type (press enter for PAT) >
Enter personal access token >
Enter personal access token > Exiting...
Now the trick is to remember the following information:
The cmdlet is asking for a valid PAT, not the original used one!
I was trapped in the thought that the cmdlet is asking for the original used PAT.
So just create a new PAT and use this to remove the agent
Hope I saved you some time on research.