Powershell: Difference between revisions

From Wildsong
Jump to navigationJump to search
Brian Wilson (talk | contribs)
Created page with "== Test a login == Create a function in PS Function Test-ADAuthentication { param($username,$password) (new-object directoryservices.directoryentry "",$username,$..."
 
Brian Wilson (talk | contribs)
Line 1: Line 1:
== Test a login ==
== 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
Create a function in PS

Revision as of 17:35, 17 June 2022

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