frust23 11/29/2023 1:12:28 PM

Automatically close RemoteApp GP sessions so that the user is logged out

I am running GP on a 2022 Windows server and publish it to users as a RemoteApp.  That RDP server is set to reboot every weeknight in the early morning.  Sometimes users won't close out GP before they shut their laptops and go home for the night.  I am looking for a way to force the close of open GP RemoteApp sessions that logs the user out of GP properly, so that a license is not held hostage by the user's forgetfulness.  I had written a powershell script to run as a Scheduled Task on the RDP server that would look for open RemoteApp sessions that had the Dynamics process running.  It would call focus to the main Dynamics window and use SendKeys to run a logout and close macro.  However, RemoteApps doesn't allow the AppActivate method to set focus and doesn't allow the Win32 ShowWindowAsync and SetForegroundWindow methods to pull the needed MainWindowTitle or MainWindowHandle properties to set focus.

I feel like I'm banging my head against a brick wall.  Is there any good way to properly close GP out in a RemoteApp session?  I really like RemoteApps and don't want to have to send users back to the full Remote Desktop experience to use GP, but users forgetting to close out properly is causing problems.

Any help is appreciated!

Version: All
Section: Dynamics GP


Table Definition Quick Links
All Tables
SOP Tables
RM Tables
GL Tables
POP Tables
HR Tables
PM Tables
UPR Tables
IV Tables
Olympic Tables
3