Coder Social home page Coder Social logo

Comments (6)

BenLangers avatar BenLangers commented on September 3, 2024 1

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.

jborean93 avatar jborean93 commented on September 3, 2024

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.

BenLangers avatar BenLangers commented on September 3, 2024

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.

jborean93 avatar jborean93 commented on September 3, 2024

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.

cobbr avatar cobbr commented on September 3, 2024

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.

BenLangers avatar BenLangers commented on September 3, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.