"Remove-Computer" or "Remove-ADComputer" - which is best?

I'm using Windows Server 2012 R2 - trying to remove a computer from a domain using PowerShell.

Which command is best, and how are the results different?
1.  Remove-ADComputer -Identity "Server01"
(See https://technet.microsoft.com/en-us/library/ee617250.aspx )


2.  Remove-Computer -Computername Server01 -UnjoinCredential domainname\administrator -Passthru -Verbose -Force -Restart
(See https://technet.microsoft.com/en-us/library/hh849816(v=wps.620).aspx  )

Thanks a lot.
Dwight BaerStudentAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Remove-ADComputer is usually the preferred method.
Sekar ChinnakannuStaff EngineerCommented:
Remove-ADComputer -Identity "Server01" is a preferred methid
Dwight BaerStudentAuthor Commented:
Great, thanks.

But why are there two commands and why is remove-ADComputer better?  Just curious.
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Sekar ChinnakannuStaff EngineerCommented:
Remove-Computer removes the local computer from their current domains.
Remove-ADComputer removes an Active Directory computer.
Dwight BaerStudentAuthor Commented:
Ah ... Remove-ADComputer is more mulit-purpose.  OK.
Dwight BaerStudentAuthor Commented:
Thanks, both.
Remove-ADComputer operates just on AD and deletes the computer account from AD.

Remove-Computer operates on a local or remote machine and unjoins a computer from a domain, making it a member of a workgroup, and the AD account gets disabled.

So what you use depends on your intentions.  If you wanted to use the workstation as part of a workgroup or later rejoin it to the domain you'd probably use Remove-Computer.  If you just use Remove-ADComputer the workstation won't have any idea, it's corresponding info in AD would be removed right out from under it so it wouldn't be able to authenticate to the domain, etc.  That'd be fine if you're just going to wipe the machine.

Edit:  looks like you closed the question while I was typing this up.  Oh, well.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dwight BaerStudentAuthor Commented:
Sorry, the "supplementary question" was a bit of an afterthought, I didn't actually mean to close the question!  Thanks very much for your answer, footech.  Sorry about the points.
Dwight BaerStudentAuthor Commented:
Update:  Now that I've researched this further, I think the first two answers are wrong, and footech's answer is the one I should have accepted as correct.  Remove-ADComputer should ONLY be used when you plan to wipe your computer and you don't care what's on it.

Although it's a bit more complex to use, remove-computer is the tool that should usually be used.

Is there any  way that I can re-open this question and close it again as per the above?
The "Request attention" button found at the bottom of the question block will notify an admin. Just explain in the box what you would like done. In a case like this, the question can be reopened.
Dwight BaerStudentAuthor Commented:
Thanks again.  I thought I had closed this.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Active Directory

From novice to tech pro — start learning today.