"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 )

OR

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?
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.

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

But why are there two commands and why is remove-ADComputer better?  Just curious.
0
Hey MSSPs! What's your total cost of ownership?

WEBINAR: Managed security service providers often deploy & manage products from a variety of solution vendors. But is this really the best approach when it comes to saving time AND money? Join us on Aug. 15th to learn how you can improve your total cost of ownership today!

Sekar ChinnakannuStaff EngineerCommented:
Remove-Computer removes the local computer from their current domains.
Remove-ADComputer removes an Active Directory computer.
0
Dwight BaerStudentAuthor Commented:
Ah ... Remove-ADComputer is more mulit-purpose.  OK.
0
Dwight BaerStudentAuthor Commented:
Thanks, both.
0
footechCommented:
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.
1

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.
0
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?
0
jmcgOwnerCommented:
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.
0
Dwight BaerStudentAuthor Commented:
Thanks again.  I thought I had closed this.
0
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.