Remove Computer from AD Domain Using PowerShell



To remove the computer from the domain we need to use the Remove-Computer command.

Remove-Computer -ComputerName Test1-win2k16 `
                -UnjoinDomainCredential Labdomain\Administrator `
                -WorkgroupName WG -Restart -Force -PassThru

In the above example, the Computer name Test1-Win2k16 is going to remove from the domain with the domain credentials and it will be joined to WorkGroup named WG. If the system doesn’t restart due to any reason, you need to reboot the system manually.

Here the computer name is the String[]. So you can provide multiple computers to remove from the domain. For example,

Remove-Computer -ComputerName Test1-win2k16, Test1-Win2k12 `
                -UnjoinDomainCredential Labdomain\Administrator `
                -WorkgroupName WG -Restart -Force -PassThru
Updated on: 2020-12-28T07:01:58+05:30

3K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements