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

Version Path
vagrant-unbundled-2.3.6.0 plugins/hosts/windows/scripts/check_credentials.ps1
tamtam-vagrant-reload-1.2.1 vendor/cache/vagrant-2092df529ae7/plugins/hosts/windows/scripts/check_credentials.ps1
vagrant-unbundled-2.3.3.0 plugins/hosts/windows/scripts/check_credentials.ps1
vagrant-unbundled-2.3.2.0 plugins/hosts/windows/scripts/check_credentials.ps1
vagrant-unbundled-2.2.19.0 plugins/hosts/windows/scripts/check_credentials.ps1
vagrant-unbundled-2.2.18.0 plugins/hosts/windows/scripts/check_credentials.ps1