Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function Test-UserCredential {
- Param($username, $password)
- Add-Type -AssemblyName System.DirectoryServices.AccountManagement
- $ct = [System.DirectoryServices.AccountManagement.ContextType]::Machine, $env:computername
- $opt = [System.DirectoryServices.AccountManagement.ContextOptions]::SimpleBind
- $pc = New-Object System.DirectoryServices.AccountManagement.PrincipalContext -ArgumentList $ct
- $Result = $pc.ValidateCredentials($username, $password).ToString()
- $Result
- }
- $comp_username = Get-Property -Name COMPUTER_USERNAME
- $comp_password = Get-Property -Name COMPUTER_PASSWORD
- $result = Test-UserCredential -username $comp_username -password $comp_password
- if ($result)
- {
- #Enable "Next" button
- }
- else
- {
- #Disable "Next" button
- }
Add Comment
Please, Sign In to add comment