To forcibly demote a Windows Server 2003 or later domain controller (DC), you can run the command
at a command prompt. However, in Windows 2003, this command doesn't work if the DC was booted in safe mode. Thus, if you have a Windows 2003 DC that won't boot normally, you can't demote it.
In Windows Server 2008 and later, this is no longer a problem. You can use the dcpromo /forceremoval command while in safe mode, allowing you to demote a problem server. It's a welcome change in Server 2008.