OK.. Time to resurrect this thread :-)
This adds a new computer object to a domain, but doesn't actually join the domain. So beyond adding the name to AD (and enabling the machine account), what function does it do?
Is there a way to detect a value for $sDomain, without hardcoding it?
Thie is for updating an old kixforms project of mine to add freshly imaged (workgroup)PCs to the domain.
It currently works fine adding the PC, if the account doesn't already exist. If it does exist it returns an error until the old machine account is manually deleted.
I also have it hardcoded to my domain, but I'd like to make it available to all, so I'd like it to be able to detect the domain controller and then to detect all the computer OUs.
I suppose being able to delete the old computer account wouldn't require scanning AD to find the OU??