Skip to content

Instantly share code, notes, and snippets.

@jangins101
Created April 4, 2016 14:47
Show Gist options
  • Save jangins101/2fc4a4cbac105e6a603e48473a7c6bd4 to your computer and use it in GitHub Desktop.
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
$([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