diff --git a/plugins/hosts/windows/scripts/check_credentials.ps1 b/plugins/hosts/windows/scripts/check_credentials.ps1 index 28ce28a90..41c8c8298 100644 --- a/plugins/hosts/windows/scripts/check_credentials.ps1 +++ b/plugins/hosts/windows/scripts/check_credentials.ps1 @@ -11,9 +11,24 @@ $DSContext = New-Object System.DirectoryServices.AccountManagement.PrincipalCont [System.DirectoryServices.AccountManagement.ContextType]::Machine, $env:COMPUTERNAME ) - if ( $DSContext.ValidateCredentials( $username, $password ) ) { exit 0 -} else { - exit 1 -} \ No newline at end of file +} + +$DSContext = New-Object System.DirectoryServices.AccountManagement.PrincipalContext( + [System.DirectoryServices.AccountManagement.ContextType]::Domain, + $env:COMPUTERNAME +) +if ( $DSContext.ValidateCredentials( $username, $password ) ) { + exit 0 +} + +$DSContext = New-Object System.DirectoryServices.AccountManagement.PrincipalContext( + [System.DirectoryServices.AccountManagement.ContextType]::ApplicationDirectory, + $env:COMPUTERNAME +) +if ( $DSContext.ValidateCredentials( $username, $password ) ) { + exit 0 +} + +exit 1