Powershell

From Wildsong
Revision as of 17:48, 17 June 2022 by Brian Wilson (talk | contribs)
Jump to navigationJump to search

List local users

Get-LocalUser

Name               Enabled Description
----               ------- -----------
Administrator      True    Built-in account for administering the computer/domain
arcgis             True    ArcGIS Data Store
DefaultAccount     False   A user account managed by the system.
Guest              False   Built-in account for guest access to the computer/domain
sshd               True
WDAGUtilityAccount False   A user account managed and used by the system for Windows Defender Application Guard scen...

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