WVD Scaling Script: Doesn't Logoff user sessions and stop VMs during off-peak hours

%3CLINGO-SUB%20id%3D%22lingo-sub-2330278%22%20slang%3D%22en-US%22%3EWVD%20Scaling%20Script%3A%20Doesn't%20Logoff%20user%20sessions%20and%20stop%20VMs%20during%20off-peak%20hours%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2330278%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWe%20have%20experienced%20that%20during%20the%20off-peak%20hours%20the%20scaling%20script%20doesn't%20logoff%20user%20sessions%20and%20stop%20VMs%20when%20there%20are%20active%20or%20disconnected%20sessions.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3EMinimum%20number%20of%20running%20session%20host%20threshold%20is%20set%20to%201%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFindings%3A%3C%2FP%3E%3CUL%3E%3CLI%3EScript%20recognize%20it%20as%20off-peak%20hours%20but%20doesn't%20logoff%20any%20user%20sessions.%26nbsp%3B%3C%2FLI%3E%3C%2FUL%3E%3CP%3EBut%20we%20have%20noticed%20following%20log%20not%20sure%20if%20there%20is%20any%20relation.%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CFONT%20size%3D%222%22%3ENumber%20of%20user%20sessions%20is%20more%20than%2090%20%25%20of%20the%20max%20number%20of%20sessions%20allowed%20with%20minimum%20number%20of%20running%20session%20hosts%20required%20(10).%20Adjusted%20minimum%20number%20of%20running%20session%20hosts%20required%20to%202%3C%2FFONT%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%20size%3D%223%22%3EAny%20advice%20or%20a%20solution%20for%20this%20%3F%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%20size%3D%223%22%3EThank%20You!%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%20size%3D%223%22%3EBR%2C%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20size%3D%223%22%3ERomero%20Silva%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2330278%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EWindows%2010%20Virtual%20Desktop%20Azure%20WVD%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EWindows%20Virtual%20Desktop%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2331966%22%20slang%3D%22en-US%22%3ERe%3A%20WVD%20Scaling%20Script%3A%20Doesn't%20Logoff%20user%20sessions%20and%20stop%20VMs%20during%20off-peak%20hours%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2331966%22%20slang%3D%22en-US%22%3EHi%2C%3CBR%20%2F%3E%3CBR%20%2F%3EWhich%20scaling%20solutions%20are%20you%20using%3F%20Is%20the%20one%20provided%20at%20Microsoft%20Docs%20-site%3F%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvirtual-desktop%2Fset-up-scaling-script%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvirtual-desktop%2Fset-up-scaling-script%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3EHave%20you%20set%20parameter%20LimitSecondsToForceLogOffUser.%20Think%20it%20defaults%20to%20zero%2C%20but%20I'm%20not%20sure%20as%20I%20have%20not%20used%20this%20solution%20in%20ages.%20When%20set%20to%20zero%2C%20any%20user%20logged%20in%20will%20be%20left%20untouched.%3CBR%20%2F%3E%3CBR%20%2F%3EYou%20could%20control%20session%20limit%20also%20with%20Group%20Policy%20at%20Computer%20Configuration%20%26gt%3B%20Policies%20%26gt%3B%20Administrative%20Templates%20%26gt%3B%20Windows%20Components%20%26gt%3B%20Remote%20Desktop%20Services%20%26gt%3B%20Remote%20Desktop%20Session%20Host%20%26gt%3B%20Session%20Time%20Limits%3CBR%20%2F%3E%3CBR%20%2F%3EI%20use%20scaling%20solution%20by%20Travis%20Roberts%20found%20at%20%3CA%20href%3D%22https%3A%2F%2Fwww.ciraltos.com%2Fupdate-with-breadth-first-auto-scale-session-hosts-in-windows-virtual-desktop-spring-update-arm-with-azure-function%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.ciraltos.com%2Fupdate-with-breadth-first-auto-scale-session-hosts-in-windows-virtual-desktop-spring-update-arm-with-azure-function%2F%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3E-%20Jere%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Hi,

 

We have experienced that during the off-peak hours the scaling script doesn't logoff user sessions and stop VMs when there are active or disconnected sessions. 

 

Minimum number of running session host threshold is set to 1

 

Findings:

  • Script recognize it as off-peak hours but doesn't logoff any user sessions. 

But we have noticed following log not sure if there is any relation.

Number of user sessions is more than 90 % of the max number of sessions allowed with minimum number of running session hosts required (10). Adjusted minimum number of running session hosts required to 2

 

Any advice or a solution for this ?

 

Thank You!

 

BR,

Romero Silva

 

2 Replies
Hi,

Which scaling solutions are you using? Is the one provided at Microsoft Docs -site?
https://docs.microsoft.com/en-us/azure/virtual-desktop/set-up-scaling-script

Have you set parameter LimitSecondsToForceLogOffUser. Think it defaults to zero, but I'm not sure as I have not used this solution in ages. When set to zero, any user logged in will be left untouched.

You could control session limit also with Group Policy at Computer Configuration > Policies > Administrative Templates > Windows Components > Remote Desktop Services > Remote Desktop Session Host > Session Time Limits

I use scaling solution by Travis Roberts found at https://www.ciraltos.com/update-with-breadth-first-auto-scale-session-hosts-in-windows-virtual-deskt...

- Jere






Use gpo to log inactive sessions off and people who haven’t had any activity for a certain amount of time. Works fine