Who is logged in?

by Jun 12, 2012

Hello, I am newer to powershell and need a command to view a remote computers registry to determine who is logged in..

I know you can run (gwmi -class win32_computerSystem -credential domainmyadminuser -computerName DELL990station).username  

but his only returns the user if they are logged in right now…What I would like to do is check the registry to see who last logged in…

I.e. I HKLMSOFTWAREMicrosoftWindowsCurrentVersionAuthenticationLogonUI with this key value listed: LastLoggedOnUser FOR THE REMOTE COMPTER….

Any help would be greatly appreciated…there is a lot out there that touches on this but nothing i have found that actually works….