Closed cgulliver closed 6 years ago
I've never tested that. The cookbook runs this powershell command
Add-computer -DomainName #{domain} #{ou.nil? ? '' : '-OUPath "' + ou + '"'} #{server.nil? ? '' : '-Server "' + server + '"'} -Credential $credential -force -Options JoinWithNewName,AccountCreate -PassThru
if ou = nil, it should skip the -OUPath
section. Are you omitting the ou property? It is optional, so try leaving it out completely.
Yes, I tried to omit the OU property completely and also pass as an empty parameter with no luck. I don't think anyone joins machines to the Computers CN so its not a big deal.
Quick fix could be to set it as the default in the resource.
property :ou, [String, NilClass], required: false, default: 'cn=computers'
Yup @derekgroh , or alternatively you could use defined?(ou)
instead of ou.nil?
Had the same problem but this works for me:
domain_join domain do
domain domain
domain_user join_user
domain_password join_pass
ou nil
action :join
end
Closing If you have additional information, feel free to reopen.
This could be expected behavior but when testing in a sandbox, I get the following error "The system cannot find the file specified." I am attempting to join into the default "Computers" CN in the root so there is nothing to feed the OU property.