diff --git a/changelogs/fragments/win_domain-setup.yaml b/changelogs/fragments/win_domain-setup.yaml new file mode 100644 index 00000000000..cd285bd4fae --- /dev/null +++ b/changelogs/fragments/win_domain-setup.yaml @@ -0,0 +1,2 @@ +bugfixes: +- win_domain - Fix checking for a domain introduced in a recent patch diff --git a/lib/ansible/modules/windows/win_domain.ps1 b/lib/ansible/modules/windows/win_domain.ps1 index 393c5447db4..a65dbd2b143 100644 --- a/lib/ansible/modules/windows/win_domain.ps1 +++ b/lib/ansible/modules/windows/win_domain.ps1 @@ -74,7 +74,8 @@ try { # Cannot use Get-ADForest as that requires credential delegation, the below does not $forest_context = New-Object -TypeName System.DirectoryServices.ActiveDirectory.DirectoryContext -ArgumentList Forest, $dns_domain_name $forest = [System.DirectoryServices.ActiveDirectory.Forest]::GetForest($forest_context) -} catch [System.DirectoryServices.ActiveDirectory.ActiveDirectoryObjectNotFoundException] { } +} catch [System.DirectoryServices.ActiveDirectory.ActiveDirectoryObjectNotFoundException] { +} catch [System.DirectoryServices.ActiveDirectory.ActiveDirectoryOperationException] { } if (-not $forest) { $result.changed = $true