WVD Scaling Issue – User Session ID not found

I had a little issue recently when applying the WVD Spring Scaling script.

I went ahead and followed the instructions on the official Microsoft site:

https://docs.microsoft.com/en-us/azure/virtual-desktop/set-up-scaling-script

The script installed fine and I had everything set up and ready to go. Set the relevant settings in my Log App and went ahead with a quick test. All good so far!

Then I experienced a problem where the Session Hosts did shutdown, but I did not get the user message. . . . very odd.

I had a look in the logs for the scaling job and could see the job completed, but there were some warnings that it:

Failed to send a log off message and Failed to force log off user

Something doesn’t look right. . .

Looking at the warning details I could see the issue was that the User Session ID could not be found?

Can’t find the user?!

I loaded up PowerShell and tried to send a message myself using the Send-AzWVDUserSessionMessage command and found I too could not send a message! But I could via the Azure Portal!

After a bit of digging around it appeared that the issue was being caused by the Session Host name.

My Session host was named using capitals as in: SESSIONHOST.domain.com. It appears that the Send-AzWVDUserSessionMessage command is annoyingly case sensitive when it comes to the Session Host name.

If I entered the Session Host name case sensitive then it sent without issue.

Therefore, I had to quickly delve into the code of the Scaling script to resolve this.

In the Scaling script I found on Line 481 that the Session Host name was being obtained via the Get-SessionHostName function but then being converted to lower case.

To resolve my issue I simply removed the .ToLower() from the end of the line.

I saved and published the script and tested. . . . success!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s