Closed tarraschk closed 4 years ago
Based on discussions with @fwininger I changed my code to use the same execution_timeout parameter as the limit to clean old tasks :)
@mwrock can you review this PR ?
Note: additional tests show it works only on Windows Server 2012+
We are looking at modifications to make it compatible with older versions
The code is now compatible with older Windows versions
thanks @mwrock
This Pull Requests add some cleaning to the established WinRM connections.
The WinRM elevated mode uses ScheduledTasks to execute commands in elevated mode. However, sometimes, the WinRM connection "leaves" the ScheduledTask there without cleaning it.
We noticed this behaviour since the introduction of the GUID in the ScheduledTasks names.
This PR lets you configure a maximum idle time in seconds, and when we create a new winrm-elevated-shell, we clean any ScheduledTask that might have been created earlier than NOW-MAXIMUM_IDLE_TIME.
By default, this maximum idle time is set at 86400 (1 day), so that any winrm-elevated-shell will clean ScheduledTasks created at least 1 day ago.
Unit tests have been added for the integration environment to test this.