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

(cherry picked from commit 6039ff9a24)
pull/55235/head
Jordan Borean 6 years ago committed by Toshio Kuratomi
parent 5d58a7cadb
commit fb96c007b5

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

@ -48,7 +48,8 @@ try {
# Cannot use Get-ADForest as that requires credential delegation, the below does not # 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_context = New-Object -TypeName System.DirectoryServices.ActiveDirectory.DirectoryContext -ArgumentList Forest, $dns_domain_name
$forest = [System.DirectoryServices.ActiveDirectory.Forest]::GetForest($forest_context) $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) { If(-not $forest) {
$result.changed = $true $result.changed = $true

Loading…
Cancel
Save