How To Get The Last User Logged Into A Computer With PowerShell

As an Administrator, I have been asked more than once to find out where a computer is on the network. This question is usually asked by someone that needs to inventory or lifecycle the equipment. If your IT department is well organized or you have some sort of 3rd party software running that does this for you, you probably don’t have a whole lot of use for this script.

If, on the other hand, you’re the 1 man/woman IT shop at a small business with no access to 3rd party tools… this script may save you some time. All we want to know is what user is currently logged in to the machine, or the last user to log in. The assumption is, if we know the user, it’s fairly easy to find out where he or she sits within your organization.

Recommended Reading
Learn Windows PowerShell in a Month of Lunches –
PowerShell in Depth 2nd Edition –
An Administrator’s Guide: Powershell in Depth –
Windows PowerShell Best Practices –
Windows PowerShell Cookbook: The Complete Guide to Scripting Microsoft’s Command Shell –

Sound Effects:
Twitter: @signalwarrant
Google +:
YouTube Subscribe link: