Disable Game Mode on Windows devices using Intune

Disable Game Mode on Windows devices using Intune
Disable Game Mode on Windows devices using Intune

When you activate Game Mode, Windows prioritizes the gaming experience by allocating system resources to games. This enhances the smoothness and quality of your gaming experience.

Several background actions occur when you enable Game Mode. First, it prevents Windows updates from installing drivers and displaying restart notifications. Additionally, it adjusts the frame rate to optimize gaming performance.

However, in an enterprise environment, it’s often best to keep this setting turned off. In this blog post, we will explore how to disable Game Mode using Intune.

To do this, we will create two registry entries, “AllowAutoGameMode” and “AutoGameModeEnabled,” under HKEY_CURRENT_USER\SOFTWARE\Microsoft\GameBar. We’ll achieve this by deploying a PowerShell script to end-user devices using Win32 app deployment through Intune.

STEP 1 – Registry Keys to Disable Game Mode

To disable Game Mode on Windows 10 or Windows 11 using Intune, ensure that both “AllowAutoGameMode” and “AutoGameModeEnabled” are of type REG_DWORD, and their values are set to 0.

STEP 2 – Create a Powershell script

  1. Create a Powershell script using the two lines of code below. For example Gamemode_O.ps1
  2. Place the PowerShell script in a dedicated folder. For example: “C:\GameOff_O.” Ensure that there are no other files or folders inside the “C:\GameOff_O” directory, apart from the “Gamemode_O.ps1” file.
New-ItemProperty -Path HKCU:\Software\Microsoft\GameBar -Name 'AllowAutoGameMode' -Value '0' -Type DWORD -Force

New-ItemProperty -Path HKCU:\Software\Microsoft\GameBar -Name 'AutoGameModeEnabled' -Value '0' -Type DWORD -Force

STEP 3 – Create IntuneWin File

You can follow below steps to create .IntuneWin file which will be used for the deployment.

  • Create an empty folder for example C:\output or anywhere you like.
  • Download Microsoft Win32 Content Prep Tool. Its a zip file therefore extract its contents into a folder.
  • Repackage the application folder C:\GameOff_O to .intunewin file using IntuneWinAppUtil.exe.

Use below command to create Intunewin file:

IntuneWinAppUtil.exe -c <setup_folder> -s <setup_file> -o <output_folder>
  • <setup_folder> = Provide the location C:\GameOff_O
  • <setup_file> = Gamemode_O.ps1
  • <output_folder> = C:\Output

Example:

.\IntuneWinAppUtil.exe -c C:\GameOff_O -s GameMode_O.ps1 -o c:\output
Create IntuneWin File
Create IntuneWin File

Once the command has finished, you can verify the creation of the “.intunewin” file in the “C:\Output” folder. We will use this “.intunewin” file to set up the Win32 app deployment, as we’ll see in the following steps.

STEP 4 – Create App deployment on Intune

Now, we have .Intunewin file created, Let’s check the deployment steps:

  • Login on Microsoft Intune admin center
  • Click on Apps and then click on All Apps.
  • Click on + Add and Select Windows app (Win32) from the app type.

App Information Tab

Click on “Select app package file” and browse to .Intunewin file. Provide Information in below mandatory fields. The rest of the fields are optional but can be useful for application documentation and troubleshooting issues.

  • Name: GameMode_Off_Settings
  • Description: GameMode_Off_Settings
  • Publisher: MS-Custom

Program Tab

Provide the Install command, uninstall commandInstall behavior, Device restart behavior. Click on Next to proceed.

  • Install command:  powershell.exe -Executionpolicy Bypass -File .\Gamemode_O.ps1
  • Uninstall command: powershell.exe -Executionpolicy Bypass -File .\Gamemode_O.ps1
  • Install behavior: User
  • Device restart behavior: No specific Action

Requirements Tab

You can specify the requirements that devices must meet in order to deploy the app. If your devices are a mix of 32-bit and 64-bit types, then check both the boxes for 32-bit and 64-bit in the Operating system architecture drop-down. Else, just go with 64-bit.

  • Operating System Architecture: 64-bit
  • Minimum operating system: Select the minimum OS requirement for this deployment.

Detection Rules

To ensure that both registry keys exist and have their values set to 0, we’ll use a custom detection script. Create a PowerShell script with the following code and save it on your device. You can choose any name for this PowerShell script file; for example, let’s call it “GamekeysDetect.ps1.”

$Path1 = "HKCU:\SOFTWARE\Microsoft\GameBar"
$Name1 = "AllowAutoGameMode"
$Type1 = "REG_DWORD"
$Value = "0"
$Path2 = "HKCU:\SOFTWARE\Microsoft\GameBar"
$Name2 = "AutoGameModeEnabled"
$Type2 = "REG_DWORD"
Try {
    $Registry1 = Get-ItemProperty -Path $Path1 -Name $Name1 -ErrorAction Stop | Select-Object -ExpandProperty $Name1
    $Registry2 = Get-ItemProperty -Path $Path2 -Name $Name2 -ErrorAction Stop | Select-Object -ExpandProperty $Name2
    If ($Registry1 -eq $Value -and $Registry2 -eq $Value){
        Write-Output "Detected"
        Exit 0
    } 
   Exit 1
}
 
Catch {
    Exit 1
}
  • From the Detection rules page, select “Use a custom detection script” as the Rule format, and in the Script File field, specify “GamekeysDetect.ps1.”
Use a custom detection script
Use a custom detection script

Assignments Tabs

Click on Add group to add an Azure AD group containing users or devices. You can also click on Add all users or Add all devices.

Review + Create

Review the deployment and click on Create to start the deployment process.

STEP 5 – Monitoring the Deployment Progress

You can follow below steps to monitor the installation:

  • From the Microsoft Intune admin center >Apps > All apps. Click on the deployment and check the Overview page which will show the deployment status.

Sync Intune Policies

The device check-in process might not begin immediately. If you’re testing this policy on a test device, you can manually kickstart Intune sync either from the device itself or remotely through the Intune admin center.

Alternatively, you can use PowerShell to force the Intune sync on Windows devices. Another way to trigger the Intune device check-in process is by restarting the device.

End-user Experience

Disable Game mode Policy applied
Disable Game mode Policy applied
  • Once the script execution is finished, you will find two REG_DWORD registry entries, AllowAutoGameMode and AutoGameModeEnabled, created under the HKEY_CURRENT_USER\SOFTWARE\Microsoft\GameBar registry key, and both of their values will be set to 0.
Disable Game mode registry entries
Disable Game mode registry entries

Leave a Comment