Using a simple command, you could add or remove a Windows computer to a Microsoft Windows domain remotely from another computer.
Add a Computer to the Domain
Execute this command from a domain controller:
Execute this command from a workstation where you have domain admin rights.
Change the words in italics to suit your situation:
Remove a Computer from the Domain
These command are especially valuable if you are using batch files.