Powershell: Difference between revisions
From Wildsong
Jump to navigationJump to search
Brian Wilson (talk | contribs) mNo edit summary |
Brian Wilson (talk | contribs) mNo edit summary |
||
Line 1: | Line 1: | ||
== Inspect environment variables == | |||
All environment variables | |||
gci env: | |||
All on one line | |||
gci env:path | |||
Format list so it's readable | |||
gc- env:path | fl | |||
== List local users == | == List local users == | ||
Latest revision as of 19:58, 19 October 2022
Inspect environment variables
All environment variables
gci env:
All on one line
gci env:path
Format list so it's readable
gc- env:path | fl
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