Skip to content

Latest commit

 

History

History
62 lines (38 loc) · 3.78 KB

how-to-windows-shutdown.md

File metadata and controls

62 lines (38 loc) · 3.78 KB
title description services ms.service ms.author author ms.topic ms.date
Control shutdown for Windows lab VMs
Remove the shutdown command from the Windows Start menu in a lab virtual machine in Azure Lab Services.
lab-services
azure-lab-services
rosemalcolm
RoseHJM
how-to
06/02/2023

Control Windows shutdown behavior in lab virtual machines

[!INCLUDE Retirement guide]

In this article, you learn how to remove the shutdown command from the Windows Start menu in lab virtual machines in Azure Lab Services. When a lab user performs a shutdown in the operating system instead of stopping the lab virtual machine, the shutdown might interfere with the Azure Lab Services cost control measures.

Azure Lab Services provides different cost control measures, such as lab schedules, quota hours, and automatic shutdown policies.

When the Windows shutdown command is used to turn off a lab virtual machine, the service considers the lab virtual machine to still be running and accumulating costs. Instead, lab users should use the stop functionality of the lab virtual machine. To prevent inadvertently shutting down the lab virtual machine, you can remove the shutdown command from the Windows Start menu.

Lab users can still disconnect from the lab virtual machine. The Windows disconnect command triggers the lab policy (if enabled) that shuts down the lab virtual machine when users disconnect.

Remove Windows shutdown command from Start menu

You can use Windows local group policy settings to remove the shutdown command from the Windows Start menu. Modify this policy on the lab template virtual machine to ensure that the change applies to all lab virtual machines.

To configure a local group policy setting by using PowerShell:

  1. Connect to the lab template virtual machine by using RDP.

  2. Run the following PowerShell command to disable the shutdown option in the Start menu:

    Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "HidePowerOptions" -Value 1 -Force

Alternately, you can manually change the local group policy setting:

  1. Connect to the lab template virtual machine by using RDP.

  2. Press the Windows key, type gpedit, then select Edit group policy (Control panel).

  3. Go to Computer Configuration > Administrative Templates > Start Menu and Taskbar.

    :::image type="content" source="./media/how-to-windows-shutdown/group-policy-shutdown.png" alt-text="Screenshot of Group Policy Editor in Windows." lightbox="./media/how-to-windows-shutdown/group-policy-shutdown.png":::

  4. Right-select Remove and prevent access to the Shut Down, Restart, Sleep, and Hibernate commands, and then select Edit.

  5. Select the Enabled setting, and then select OK.

    :::image type="content" source="./media/how-to-windows-shutdown/edit-shutdown.png" alt-text="Screenshot of Remove and prevent access to the Shut Down, Restart, Sleep, and Hibernate commands dialog in Windows.":::

  6. Notice that the shutdown command no longer appears under Windows Start menu. Only the Disconnect command appears.

    :::image type="content" source="./media/how-to-windows-shutdown/start-menu.png" alt-text="Screenshot of the Start menu in Windows. The power button and disconnect item are highlighted.":::

Next steps