Add computer to OU
I'm trying to figure out how to get CD to add a computer to a specific OU during the deploy process.
Am I right in thinking it works like the computer name change procedure. ie. setup the unattend.xml then configuring a profile for that image?
I have attached my unattend file as my issue might be with this xml file. (the extension shows txt but when I sysprep I rename it to xml)
thanks for you help.
dustin.eder last edited by
I'd assume you just change this [code]<MachineObjectOU>computers</MachineObjectOU>[/code] to whatever OU.
I personally use a powershell script that runs after setup.
processor last edited by
Seems to be a known issue:
as Dustin suggest best solution is to use powershell:
davidberino last edited by
I second the powershell script.
Ok, I have embraced the power shell idea and have found a script that works when I run it on the computer to be added to the domain. But it doesn't work when it's processed via a deploy in CD.
Here is the scrip that I'm using
$cred = New-Object System.Management.Automation.PsCredential("domain\useraccountwithjoinpermissions", (ConvertTo-SecureString "useraccountpassword" -AsPlainText -Force)) Add-Computer -DomainName "your.domain.here" -Credential $cred -OUPath "OU=computers,OU=yourlocation,DC=your,DC=domain,DC=here" Restart-Computer
And it's setup as follows.
Computers, Computername I pick image profile of default
in Images, "image name" Profile, Default scripts I have a scrip item with the above content modified for my environment.
As I said the PS script works if I manually run it on my test machine but when I deploy to that same computer it doesn't add the computer to my domain.
Is there something I'm missing?
thanks for any help you can offer.
Guest last edited by
They were referring to running the script after imaging as more of setupcomplete type of thing. This won't work using CloneDeploy scripts since they run during imaging, you need something to run after imaging, but I think everyone is making this too complicated. I believe @vbourke does something like this.
All you need to do is create a sysprep tag in CloneDeploy with the opening tag:
and closing tag
In the tag contents you put in the ou you want like:
Or you can use custom attributes
Assign the sysprep tags to the image profile.
As long as your sysprep answer file has the MachineObjectOU tag somewhere in it, CloneDeploy will update it with the appropriate information based on the image profile, and sysprep will take of the rest.
I must have read the first post to my request as the only way it could be done.
Thanks for setting me on the easy path. I'll try this again