Check Domain and Application Directory contexts for credentials when validating SMB creds
This commit is contained in:
parent
574e40a20f
commit
5981f141e3
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
$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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user