Hi,
Probably something like this you are looking but will require some changes to the script to customise according to your requiremetns - https://4sysops.com/archives/how-to-find-a-logged-in-user-remotely-using-powershell/
But this is a good start and gather data in the initial stage.
Hope this helps.
JS
==
Please Accept the answer if the information helped you. This will help us and others in the community as well.