Anyone have experience of using the
JoinDomainOrWorkgroup Method of the
I want to write a powershell script to join a machine to a domain. There may be an existing computer account for the machine, and if so I want to delete it and rejoin to the domain.
I've already scripted the "search and destroy" part that will delete the computer account if it exists, but just noticed the
FJoinOptions switches on Technet. Trouble is - they're a bit ambiguous.
4 (0x4) Deletes an account when a domain exists. mean it will delete the computer account if it already exists on the domain?
Also, can you specify the computername you want to join the machine under with this method, or should you do a rename and then join the domain.
NB - I've been using the guide at http://msdn.microsoft.com/en-us/library/aa392154(VS.85).aspx - not sure if there's a better resource out there.