אתה ניסית את הפקודה tsdiscon
?
https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/tsdiscon#:~:text=Disconnects a session from a Remote Desktop Session Host server. If you don't specify a session ID or session name%2C this command disconnects the current session.
הנחתי שאין פקודה קיימת בגלל שכתבת שחיפשת ולא מצאת, אז כשחיפשתי לי איזו פונקציה בwinapi עושה את זה, גיליתי את הפקודה הזו.