I recently added a user to the local administrators group on a server, a while later I received an email asking who was added. The only problem was that the auditor only had the Session Identifier (SID) instead of the users samaccountname.
So I went to work and came up with the following to determine a users account id if given the session id.