Created
April 4, 2016 14:47
-
-
Save jangins101/2fc4a4cbac105e6a603e48473a7c6bd4 to your computer and use it in GitHub Desktop.
Get local users name, last login time and whether they are disabled or not
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
$([ADSI]"WinNT://$env:COMPUTERNAME").Children | ?{ $_.SchemaClassName -eq 'user' } | Select-Object @{l='name';e={$_.name}}, @{l='LastLogin';e={$_.lastlogin}}, @{l='IsDisabled';e={[bool]($_.userflags.value -band 0x2)}}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment