I ran into an issue earlier this week where I had to remove a computer from a particular domain… but the domain no longer existed. This meant that I couldn’t provide ‘domain admin’ credentials to nicely remove the computer and join it back to WORKGROUP.
Fortunately, this can be done from the command prompt via. WMI.
I started by logging into the computer as a local administrator.
start /B /W wmic.exe /interactive:off ComputerSystem Where "Name='%computername%'" Call UnJoinDomainOrWorkgroup FUnjoinOptions=0
start /B /W wmic.exe /interactive:off ComputerSystem Where "Name='%computername%'" Call JoinDomainOrWorkgroup name="WORKGROUP"
After a reboot, the computer was no longer a domain member, but a member of WORKGROUP.