You will need to perform unprovisioning to get back to the factory state. Use the WS-Management AMT_SetupAndConfigurationService.Unprovision() method or the equivalent SOAP command. The SDK documentation talks about what gets reset when you perform these commands.
I am a tester and am not familiar with the coding,Are there other ways to restore the amt to the factory setting? Such as RTCRST jumper or other manual operator .