Search
StarWind is a hyperconverged (HCI) vendor with focus on Enterprise ROBO, SMB & Edge

Schedule the Start and Stop of Your Windows Virtual Desktop VMs

  • January 30, 2020
  • 6 min read
IT and Virtualization Consultant. Romain is specializing in Microsoft technologies such as Hyper-V, System Center, storage, networking, and MS Azure. He is a Microsoft MVP and MCSE in Server Infrastructure and Private Cloud.
IT and Virtualization Consultant. Romain is specializing in Microsoft technologies such as Hyper-V, System Center, storage, networking, and MS Azure. He is a Microsoft MVP and MCSE in Server Infrastructure and Private Cloud.

Windows Virtual Desktop provides a turnkey VDI solution for Microsoft Azure. The infrastructure components such as RD Broker or RD Web Access are “hidden.” In Microsoft Azure Portal, you can only see the RD Host Session (for pooled sessions) or Windows 10 VMs (for personal sessions). Because these Azure VMs are running, they use Azure credit. To reduce the amount of your invoice, you can shut down the Azure VMs during off-hours such as nights or weekends. Then, the VMs are started again to be available during working hours.

You can implement that by using an Azure Automation account and an automatic startup/shutdown solution. In this topic, we will see how to accomplish that.

Disasters Don’t Spell Irreversibility: Learn About Built-in Disaster Recovery (DR) Options for VMware and Microsoft Environments

Learn from this video about:

  • IT service continuity and disaster recovery (DR) in a virtualized environment
  • Overview of IT service continuity and DR approaches
  • Built-in DR tools in Microsoft Hyper-V and VMware vSphere
  • Azure Site Recovery: worth using or not?
Free of Charge. No Registration.

Requirements

To follow this topic, you need the following:

  • A working Windows Virtual Desktop solution
  • A working Log Analytics workspace
  • A working Azure Automation account

How to implement the solution

Navigate to your Azure Automation account and click on Start/Stop VMs. Then select Manage the solution.

Azure Automation account

Next click on Create solution.

Azure Automation account - Create solution

In the marketplace, type start/stop and select Start/Stop VMs during Off-Hours.

Start/Stop VMs during Off-Hours

Next click on Create.

Start/Stop VMs during Off-Hours - create

In the configuration wizard, select your log analytics workspace and your Azure Automation account. Then, in the parameters section, set the following settings:

  • Name of the target resource group. Specify the resource group where the Windows Virtual Desktop VMs are located. Be careful, all VMs in this resource group will be scheduled to shut down.
  • VM Exclude. Specify the VMs you don’t want in this scheduling.
  • Schedule. Specify when you want to shutdown and restart your VMs.
  • E-mail functionality. If you choose Yes, specify an E-mail to create an alert (in Azure Monitor) and send a notification when the VMs are stopped and started.

Azure Automation account - parameters

Check the result

After I created the solution, I left Azure for one day. Next day, I checked the monitoring counter in the Azure VMs, and I saw that between 6:00pm and 9:00am no resources were consumed.

Check the result

In the solution, I saw several recent jobs showing that VMs were stopped and started.

 VMs were stopped and started

Parameters

Finally, I received an E-mail to notify me that VMs were started.

VMs were started

Change the scheduling

If you need to change the schedule of the solution, you can navigate to ScheduledStartStop_Parent. Then, open the Schedules tab. There, you can change the scheduling of your jobs.

ScheduledStartStop_Parent

Found Romain’s article helpful? Looking for a reliable, high-performance, and cost-effective shared storage solution for your production cluster?
Dmytro Malynka
Dmytro Malynka StarWind Virtual SAN Product Manager
We’ve got you covered! StarWind Virtual SAN (VSAN) is specifically designed to provide highly-available shared storage for Hyper-V, vSphere, and KVM clusters. With StarWind VSAN, simplicity is key: utilize the local disks of your hypervisor hosts and create shared HA storage for your VMs. Interested in learning more? Book a short StarWind VSAN demo now and see it in action!