Hi,
I didn't find such a script however you can use the quser command to get all the user sessions on a Remote Desktop Session Host server.
Please refer to below links for more details.
https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/quser
https://devblogs.microsoft.com/scripting/automating-quser-through-powershell/
Best Regards,
Ian Xue
-----------------------------
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.