Forcibly Remove Computer from Domain

Unjoin a computer from a domain, when you cannot contact the domain

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.

Licensed under CC BY-NC-SA 4.0
Built with Hugo
Theme Stack designed by Jimmy