2

I want to give the users an announce before the virtual machine shutdown. Background:
1, 10 users sign on one virtual machine (Windows Virtual Desktop: Windows 10) 2, The virtual machine will shut down at 10:00 pm, and I want to give users an announce at 9:55 pm to let them know that. 3, I want to use the task schedule and script work together to achieve the goal. Is there have someone who knows how to write the script? Here is some code for reference:

    <Variable Name="LimitSecondsToForceLogOffUser" Value="5"/>
    <!-- Message title sent to a user before forcing logoff -->
    <Variable Name="LogOffMessageTitle" Value="System Under Maintenance"/>
    <!-- Message body to send to a user before forcing logoff -->
    <Variable Name="LogOffMessageBody" Value="Please save your work and logoff!"/>
Arthur
  • 103
  • 11
  • If you are using WVD, have you looked at: https://learn.microsoft.com/en-us/powershell/module/windowsvirtualdesktop/send-rdsusersessionmessage ? This allows you to use PowerShell to send the message. Assuming you have a Service Principal in AAD, you can create your own scheduled task to send a message. Moreover, you can also disconnect and log off the users (so that you don't shut down the VM and lose data). Last, but not least, you should look at the scaling script: https://learn.microsoft.com/en-us/azure/virtual-desktop/set-up-scaling-script (does most of this for you automatically) – cdavid Dec 26 '19 at 18:51
  • @cdavid Thanks so much for your comment. I checked the PowerShell command, but I don’t know how to use it work together with the task scheduler. I am so sorry to say it but can you tell me how to do the setting. ⇒Like, the users who use VM2 and VM3 will receive a message on 7:00 pm every day (the users who log on VM1 will not receive the meaasge). Should I set the task schedule in each VM? – Arthur Dec 27 '19 at 00:59
  • @cdavid I saw the document about Scale session hosts dynamically. ⇒ Because I only have 3 VMS connect to the Hostpool, so I want to use the Azure Start/stop during off-hours solution to schedule two vms to let them keep running only at the work time and shut down in the night. But I want to send a message to the users before the vms shut down. By the way, is it possible to change the scaling script to make it only keep the function in my post? Thanks so much again and happy new year. – Arthur Dec 27 '19 at 01:00

0 Answers0