Last active
October 12, 2015 01:15
-
-
Save martin9700/b22c566b2bc4c5c7c997 to your computer and use it in GitHub Desktop.
This file contains 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
$Users = @{} | |
ForEach ($User in $AllUsers) | |
{ If ($Users.ContainsKey($User.SamAccountName)) | |
{ If ($Users[$User.SamAccountName].lastLogon -lt $User.lastLogon) | |
{ $Users[$User.SamAccountName].lastLogon = $User.lastLogon | |
} | |
} | |
Else | |
{ $Users.Add($User.SamAccountName,($User | Select SamAccountName,Name,lastLogon)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment