Sha256: a385b20693bb7196a650b95a07196988066c91475f1678d93b08960f68eb1d1b
Contents?: true
Size: 1018 Bytes
Versions: 6
Compression:
Stored size: 1018 Bytes
Contents
Param( [Parameter(Mandatory=$true)] [string]$username, [Parameter(Mandatory=$true)] [string]$password ) Add-Type -AssemblyName System.DirectoryServices.AccountManagement $DSContext = New-Object System.DirectoryServices.AccountManagement.PrincipalContext( [System.DirectoryServices.AccountManagement.ContextType]::Machine, $env:COMPUTERNAME ) if ( $DSContext.ValidateCredentials( $username, $password ) ) { exit 0 } $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
Version data entries
6 entries across 6 versions & 2 rubygems