Powershell

From Wildsong
Jump to navigationJump to search

Test a login

Grabbed from https://serverfault.com/questions/410240/is-there-a-windows-command-line-utility-to-verify-user-credentials

Create a function in PS

Function Test-ADAuthentication {
    param($username,$password)
    (new-object directoryservices.directoryentry "",$username,$password).psbase.name -ne $null
    }

Apply it

Test-AdAuthentication "MYDOMAIN\brian" "password123"
True