We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

garegin • 2 years ago

Hi Paul

Awesome script. Did you consider putting the $maxevents into the get-winevent call instead of filtering the output. The reason I say that is because the first way is more efficient.

Bryan • 2 years ago

Awesome script Paul, and thank you. I am having issues with it not removing the duplicates. It appears the end part of the code is not functioning properly. Any ideas on how to make it work?

Bob • 2 years ago

Hi Paul,
I'm trying run this script but nothing is displayed as following. I don't modify anything in the script

PS C:\admin\scripts> .\Get-UserLogonSessionHistory.ps1
PS C:\admin\scripts>

Paul • 2 years ago

Hi Bob - The name of the script from the article is 'Get-LastLoginInfo' and you're calling 'Get-UserLogonSessionHistory' - I am not sure if you named it or not, but you'll need to dot source the script first. <dot> <space> <dot>\Get-LastLoginInfo.ps1


PS C:\admin\scripts>. .\Get-LastLoginInfo.ps1
PS C:\admin\scripts>Get-LastLoginInfo