We use SCCM OSD for server deployment. One of our pre-build steps is for the builder to manually create the computer object in AD and in the appropriate OU.
During the build process using SCCM OSD, I can run scripts to do things. I want one of those scripts to join the computer to the domain and ignore the fact that the object already exists in AD.
If the computer object exists in AD and I manually join the computer to the domain, everything works fine. However when I try and script this using powershell or vbscript, it bombs out because the object is already there. I don't know why this is the case and I haven't found a workaround for it.
Just to answer the inevitable questions that will arise, we have a very complex OU structure so we can't script adding the servers to one OU because a server could go into one of any of the 30 or so OUs we have. We deploy a high volume of servers for different business units within the company. Also, it is far more preferable to have the builders create the objects first rather than letting a script add the servers to the generic Computers OU or some other OU and risk having them forget to move the objects, resulting in issues later on.
I would think there would be a simple piece to add to a script to have it ignore the objects exists and simply join the domain rather than join and create the object. How can I get around this. Please provide a full script if you can as I am new to scripting. I don't care if its vbscript or powershell.