[wpdm_file id=6]If you are using Windows 2008 R2 Remote Desktop Services you might have noticed that there are various user logon modes available on the Remote Desktop Session Host; which you can see from the screen shot below:
These are all well and good should you wish to manually change the user logon modes i.e. Allow reconnections but prevent new logins until the server is restarted for say maintenance purposes. But if you are already using RES Automation Manager why not complete this task in a more automated fashion? Well this can be easily achieved by adding the following tasks and module parameter.
Module Tasks:
Module Parameters.
Module Task 1 (Enable Logons):
- Add Task > Remote Terminal Server Logons.
- Settings > Enable Logons.
- Condition Expression > User Logon Mode = 1.
- Condition Expression > Computer Function = Terminal Server.
- If condition is TRUE then > Execute this task, but skip all remaining tasks in this module.
- If condition is FALSE then > Skip this task.
Module Task 2 (Disable Logons) :
- Add Task > Remote Terminal Server Logons.
- Settings > Disable Logons.
- Condition Expression > User Logon Mode = 2.
- Condition Expression > Computer Function = Terminal Server.
- If condition is TRUE then > Execute this task, but skip all remaining tasks in this module.
- If condition is FALSE then > Skip this task.
Module Task 3 (Allow connections) :
- Add Task > Registry Settings (Apply).
- Settings > Add the following registry value.
- [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server]
“TSServerDrainMode”=dword:00000000. - Condition Expression > User Logon Mode = 3.
- Condition Expression > Computer Function = Terminal Server.
- If condition is TRUE then > Execute this task, but skip all remaining tasks in this module.
- If condition is FALSE then > Skip this task.
Module Task 4 (Allow reconnections, but prevent new logons) :
- Add Task > Registry Settings (Apply).
- Settings > Add the following registry value.
- [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server]
“TSServerDrainMode”=dword:00000002. - Condition Expression > User Logon Mode = 4.
- Condition Expression > Computer Function = Terminal Server.
- If condition is TRUE then > Execute this task, but skip all remaining tasks in this module.
- If condition is FALSE then > Skip this task.
Module Task 5 (Allow reconnections, but prevent new logons until server is restarted) :
- Add Task > Registry Settings (Apply).
- Settings > Add the following registry value.
- [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server]
“TSServerDrainMode”=dword:00000003. - Condition Expression > User Logon Mode = 5.
- Condition Expression > Computer Function = Terminal Server.
- If condition is TRUE then > Execute this task, but skip all remaining tasks in this module.
- If condition is FALSE then > Skip this task.
Once you have created the module, when you come to schedule the job its then a simple matter of selecting which logon mode you would like to apply from the job parameters. Of course you can schedule the job on individual, multiple or teams of agents.
To make life even easier I’ve created a handy building block that you can import into your environment.
[wpdm_file id=6]
Any questions just ask.
Enjoy
Nathan