JoinDomainOrWorkgroup Method FJoinOptions help
Posted
by Ben
on Server Fault
See other posts from Server Fault
or by Ben
Published on 2010-06-08T09:03:34Z
Indexed on
2010/06/08
9:12 UTC
Read the original article
Hit count: 860
Anyone have experience of using the JoinDomainOrWorkgroup
Method of the Win32_ComputerSystem
Class?
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.
Does 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.
Cheers,
Ben
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.
© Server Fault or respective owner