Last active
February 8, 2024 18:16
-
-
Save JohnLBevan/ce79b234881ebe732c20ac54d2ca72ae to your computer and use it in GitHub Desktop.
If you want to check the credentials you have for a local user account are correct, you can use this script (from: https://blog.idera.com/database-tools/test-local-user-account-credentials )
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$username = 'username' | |
$password = 'password' | |
$computer = $env:COMPUTERNAME | |
Add-Type -AssemblyName 'System.DirectoryServices.AccountManagement' | |
$obj = [System.DirectoryServices.AccountManagement.PrincipalContext]::new('machine',$computer) | |
$obj.ValidateCredentials("$computer\$username", $password) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment