diff --git a/changelogs/fragments/win_domain_group_membership-Fix-missing-vars-for-Get-command.yml b/changelogs/fragments/win_domain_group_membership-Fix-missing-vars-for-Get-command.yml new file mode 100644 index 0000000000..105ad4282c --- /dev/null +++ b/changelogs/fragments/win_domain_group_membership-Fix-missing-vars-for-Get-command.yml @@ -0,0 +1,2 @@ +bugfixes: + - "win_domain_group_membership - Fix missing @extra_vars on Get-ADObject to support dirrent domain and credentials for retrival (https://github.com/ansible/ansible/issues/57404)" diff --git a/lib/ansible/modules/windows/win_domain_group_membership.ps1 b/lib/ansible/modules/windows/win_domain_group_membership.ps1 index 7b8564364a..744633ea3d 100644 --- a/lib/ansible/modules/windows/win_domain_group_membership.ps1 +++ b/lib/ansible/modules/windows/win_domain_group_membership.ps1 @@ -52,7 +52,7 @@ $members_before = Get-AdGroupMember -Identity $name @extra_args $pure_members = [System.Collections.Generic.List`1[String]]@() foreach ($member in $members) { - $group_member = Get-ADObject -Filter "SamAccountName -eq '$member' -and $ad_object_class_filter" -Properties objectSid, sAMAccountName + $group_member = Get-ADObject -Filter "SamAccountName -eq '$member' -and $ad_object_class_filter" -Properties objectSid, sAMAccountName @extra_vars if (!$group_member) { Fail-Json -obj $result "Could not find domain user, group, service account or computer named $member" }