-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
microsoft.ad.computer fails if computer already exists #43
Comments
I cannot replicate this error and we even have integration tests covering this scenario. Do you have a custom path for new computers? The way the module checks if the computer already exists is by combinding the $GUID_COMPUTERS_CONTAINER_W = 'AA312825768811D1ADED00C04FD8D5CD'
$defaultNamingContext = (Get-ADRootDSE -Properties defaultNamingContext).defaultNamingContext
$defaultPath = Get-ADObject -Identity $defaultNamingContext -Properties wellKnownObjects |
Select-Object -ExpandProperty wellKnownObjects |
Where-Object { $_.StartsWith("B:32:$($GUID_COMPUTERS_CONTAINER_W):") } |
ForEach-Object Substring 38
"CN=Host1,$defaultPath" If you run that does the computer account exist. If you were to run Interestingly |
If it can help, I have the exact same issue (including the mention of New-ADComputer trying to create a new account. Switched back to community.windows.win_domain_computer with same config except for 'ou' instead of 'path'. Tried microsoft.ad.group with or without identity specified but get the same error when the computer account already exists in AD (either in the actual OU or elsewhere in AD). If there is anything I can look up or supply, let me know? |
At a guess I think it's going to be related to #44 (comment). Essentially the purpose of
I would see what the value is for |
I think I oversimplified my example. In my case, I was doing something strange and incorrect with |
I have tried with 'identity' instead of 'name' after I saw that remark elsewhere, but this fails exactly the same. Had to switch back to the old modules to be able to stay on schedule in my project but will try and test as requested and update. |
Been able to revisit this. Swapped the deprecated modules out again. The microsoft.ad.computer module works without error if I only use path and name, and leave identity out of it completely. All green again, looking good. |
SUMMARY
The
microsoft.ad.computer
module fails if the computer already exists.ISSUE TYPE
COMPONENT NAME
microsoft.ad.computer
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
Ansible host: Ubuntu 20.04
Ansible target: Microsoft Windows Server 2016
STEPS TO REPRODUCE
EXPECTED RESULTS
Expect to get a CHANGED status and then an OK status
ACTUAL RESULTS
Second attempt to create computer results in failure with error:
New-ADComputer failed: The specified account already exists
The text was updated successfully, but these errors were encountered: