Comments (6)
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.
from microsoft.ad.
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 name
provided with the default computer path. The following code will produce the DN of the computer object that is checked before it exists.
$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 New-ADComputer
manually does it create the computer object in the $defaultPath
specified above for you?
Interestingly New-ADComputer
seems to be trying to create the object CN=Host1,DC=example,DC=local
unless that's just something you've set as an example.
from microsoft.ad.
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?
from microsoft.ad.
At a guess I think it's going to be related to #44 (comment). Essentially the purpose of name
used in the microsoft.ad.*
modules are not for an accounts sAMAccountName
but rather it refers to the cn
of the AD object itself. The identity
option can be used by the caller to help the module find the account and do operations like a rename or move but due to the current behaviour of path
as mentioned in that comment it's less than idal.
If there is anything I can look up or supply, let me know?
I would see what the value is for $defaultPath
for you, whether it's the expected default or a custom path set. I would also use New-ADComputer
with a dummy account to see where it created the AD computer object and if it's in the $defaultPath
from the above path. Finally I would try Get-ADComputer -LDAPFilter '(sAMAccountName=...)'
and see if you already have an existing computer account under that name and what path it is under.
from microsoft.ad.
I think I oversimplified my example. In my case, I was doing something strange and incorrect with dns_hostname
. Correcting that solved the issue for me. Feel free to close this issue unless @BenLangers wants to take it over.
from microsoft.ad.
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.
from microsoft.ad.
Related Issues (20)
- Encrypt LAPS credentials with ansible-vault HOT 4
- microsoft.ad.ldap inventory plugin attribute values ("__ansible_unsafe") HOT 5
- Docstring Does Match Code
- Logging verbosity HOT 2
- error in object_info Unable to find type [Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException]. HOT 1
- microsoft.ad.inventory connecting to port 22 and not ldap HOT 7
- "changed": false, "distinguished_name": null, "msg": "New-ADUser failed: The specified account already exists", "object_guid": null HOT 2
- After migrating from win_domain_computer unable to remove computer from AD HOT 3
- microsoft.ad.membership add reboot timeout option HOT 2
- microsoft.ad.domain fails with 'InstallDNS' not recognized error HOT 3
- microsoft.ad.user groups documentation should detail which formats it accepts
- How do you actually execute modules in this collection (requires powershell)? HOT 7
- Adding members to a group requires an explicit path to be set HOT 3
- The system cannot find the file specified. HOT 4
- Ansible Semaphore compatibility HOT 1
- Unable to parse microsoft.ad.ldap.yaml HOT 3
- Add action_groups HOT 3
- Using microsoft.ad.group to set members of a group does not work when both groups are in different OUs HOT 2
- microsoft.ad.object can't assign attribute PrincipalsAllowedToRetrieveManagedPassword HOT 2
- Not able to run module, giving an error AnsibleADObject not found HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from microsoft.ad.