Discussion:
JoinDomainOrWorkgroup behaviour
(too old to reply)
Bef
2009-07-06 06:29:00 UTC
Permalink
Hello

I need to join a computer into a specific OU of a domain. It must work when
the computer isn't in the domain and also when the computer-object is already
in the same or a different OU.

This function is documented here:
http://msdn.microsoft.com/en-us/library/aa392154(VS.85).aspx
Unfortunately it doesn't cover its behaviour well enough and I hope someone
here might know some more details. :)

At the moment I'm passing the destination OU and the following flags:
JOIN_DOMAIN = 1, ACCT_CREATE = 2, ACCT_DELETE = 4 and DOMAIN_JOIN_IF_JOINED =
32. I expect it to first delete de computer object from wherever it is and
then create it in the defined OU and join the domain. It doesn't work.
Do I have to call the function twice? First with the ACCT_DELETE flag and
then with the flags JOIN_DOMAIN, ACCT_CREATE and DOMAIN_JOIN_IF_JOINED?
Do I have to specify the account OU when I'm trying to delete the account or
only when I'm trying to create it?

Thank you for sharing your experience! ;)
Bef
2009-07-09 08:40:10 UTC
Permalink
Update:
I'm very curious about what the "ACCT_DELETE" flag does. The documentation
only says: "Deletes an account when a domain exists.".
I've googled for "JoinDomainOrWorkgroup ACCT_DELETE" and clicked through at
least ten pages and about 50 examples without a single one using this flag.
I've found examples which use ldap to search for the computer object and
delete it and I've found the function UnjoinDomainOrWorkgroup which can
disable the object and unjoin from the domain, but cannot delete it. I'm
wondering about replication aswell. Will I have to wait for the next
replication (about 15 min) after deleting the computer-object? I'm assuming
that's true... maybe it would work if I could be sure to execute the
deleting, creating and joining on the same domaincontroller.

Loading...