Open bantify opened 3 months ago
Where is the user magnus
located in the AD site. When you specify name: magnus
it will attempt to find the user at CN=magnus,$defaultUserLocation
where $defaultUserLocation
is the default location that new users are created at. You can get the default path by running
$GUID_USERS_CONTAINER_W = 'A9D1CA15768811D1ADED00C04FD8D5CD'
$defaultNamingContext = (Get-ADRootDSE -Properties defaultNamingContext).defaultNamingContext
Get-ADObject -Identity $defaultNamingContext -Properties wellKnownObjects |
Select-Object -ExpandProperty wellKnownObjects |
Where-Object { $_.StartsWith("B:32:$($GUID_USERS_CONTAINER_W):") } |
ForEach-Object Substring 38
In my domain's case it is CN=Users,DC=domain,DC=test
. So if the user magnus
is located in another container, for example another OU, then the module will fail to find it.
If you wish to lookup a user by the sAMAccountName
then you need to use the identity
option. The name
option is strictly just for the name/cn of the user in the LDAP sense whereas identity
is a way to lookup the user using a it's sAMAccountName
, distinguishedName
, objectSID
, objectGuid
.
Summary
Two user created successfully. I was able to delete first user by adhoc command. But 2nd user not found while trying to delete by adhoc command. But 2nd user exists in Windows AD. Play book and logs are attached below:
SUMMARY ISSUE TYPE
COMPONENT NAME
Ansible version:
Galaxy version:
Here is my var files:
My playbook:
Play book run logs:
bob user delete:
magnus user delete:
Why magnus user not found?
Though in windows AD user exists:
Please check why magnus user is not found? If we replace magnus with other name. It works.