win_domain - fix for checking for domain on new host (#55195)

pull/55203/head
Jordan Borean 6 years ago committed by GitHub
parent a5f13dd361
commit 6039ff9a24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- win_domain - Fix checking for a domain introduced in a recent patch

@ -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

Loading…
Cancel
Save