Disable Game Mode on Windows devices using Intune

When you use Game Mode, Windows will prioritize gaming experience by providing system resources to Games to make the gaming experience smoother and better. There are few actions taken in the background when you turn this switch to On. First, it will not allow Windows update to install drivers and show restart notifications and adjusts the Frame rate for better gaming experience.

But when you are working in an enterprise environment then its best to keep this setting to Off. In this blog post, we will see how to keep this setting to Off using Intune. For this, we will need to create two registry entries HKEY_CURRENT_USER\SOFTWARE\Microsoft\GameBar called AllowAutoGameMode and AutoGameModeEnabled using a Powershell script which will be deployed on end user devices using Win32 app deployment via Intune.

Registry Keys to Disable Game Mode on Window 10 or Windows 11

To Disable Game Mode on Windows 10 or Windows 11 using Intune, you need to make sure that AllowAutoGameMode and AutoGameModeEnabled both are of type REG_DWORD and Value is set to 0.

Create a Powershell script

Create a Powershell script by copying below two lines of code in notepad and saving the file as .ps1 extention. We will use this file to create Intune Win32 app. You can name the file anything you want ForExample: I have named the file as Gamemode_O.ps1.

Put this Powershell script in a separate folder lets say we put this file under C:\GameOff_O folder. Please make sure there is no other file or folder inside C:\GameOff_O apart from 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

Create IntuneWin File

To create Win32 app on Microsoft Endpoint Manager portal for creating the deployment, we first need to package Gamemode_O.ps1 file as .intunewin file. Follow below steps to create IntuneWin file:

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

We will use below command with its parameters to generate .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
.\IntuneWinAppUtil.exe -c C:\GameOff_O -s GameMode_O.ps1 -o c:\output

As the command will complete, you can check .intunewin file created in folder C:\Output. We will use this .intunewin file to create Win32 app deployment which we will see in next steps.

Create Windows app (Win32)

Follow below steps to create Intune Windows app (Win32) using .IntuneWin file.

App Information Tab

Click on Select app package file to browse and select Gamemode_O.intunewin file which can be located at C:\output folder and click on OK. On App information tab, provide Information about the Application. Update the NameDescription and Enter the name of the publisher. Click on Next to proceed.

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

Program Tab

Provide the Install command, uninstall commandInstall behavior, Device restart behavior. Keep the same command for Install and Uninstall commands. 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

Provide Operating System Architecture and Minimum operating system information. Click on Next to proceed.

  • Operating System Architecture: 64-bit
  • Minimum operating system: Select according to the operating system version being used in your enviornment. For Example: Windows 10 1607.

Detection Rules

We will use a custom detection script to verify if both of the registry keys are existing and their values are set to 0. Create a powershell script with below piece of code and save it somewhere on your device. You can name this powershell script file anything you like for example: 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
}

Now from Detection rules page, choose a Rule format as “Use a custom detection script” and in the Script File provide GamekeysDetect.ps1.

Assignments Tabs

Create an Azure AD Security group which contains users or devices where this application package needs to be deployed. Please note that if you add users into the list, it will deploy this application on all of the users devices joined to Azure and Enrolled into Intune. If you want to deploy the app to specific devices then you should add devices in the Azure AD security group not users.

Make sure to add it to the Required section which will install the application on users system as soon as possible.

Required: Select the groups for which you want to make this app required. Required apps are installed automatically on enrolled devices. Some platforms may have additional prompts for the end user to acknowledge before app installation begins.

Review + Create

Next tab is for Review + Create. Click on Create to create Win32 app package deployment which will start the process of your uploading .intunewin file and also will start the deployment process.

Intune Policy Refresh Cycle

The Device will Sync / Check in and download / intstall the application on target device. It may take some time for the process to start. Therefore, if you are testing it on a test device, you can force initiate Intune refresh cycle on the device which will speed up the download and installation process.

Also, you can restart the device first before force initiating the sync. Manual sync is not mandatory on user’s devices as the device check-in process happens automatically. But if you are testing the application on a test device then this can speed up your testing and can save some time.

End User Experience

On the target devices, there is no user interaction as this script will execute automatically in the background. However, there will be a pop-up notification related to this application if you have “Show all toast notification” setting configured at the time of application assignment.

You can disable all toast notifications from Assignments tab under End user notifications setting if you want no notifications or pop-ups related to this deployment. Below screenshot shows how the notification will look like.

First notification will be when Intune Management Extension will start downloading and Installing the app and Second notification will be to confirm if the application has been installed successfully or if its failed then it will show as the applicatin installation is failed.

After the script execution completes, you will see two REG_DWORD registry entries AllowAutoGameMode and AutoGameModeEnabled created under HKEY_CURRENT_USER\SOFTWARE\Microsoft\GameBar registry key with their value set to 0.

Conclusion

Using the powershell script deployed via Intune will disable Game bar on Windows 10 or Windows 11 devices. However, please note that the toggle switch to enable Game bar is still visible and users can go to the Settings app and Click on Gaming -> Game mode to toggle the switch to enable Game mode on their devices again.

To handle this issue, we have a detection script in place which will revert the registry values to 0 during the next Intune refresh cycle and Game mode will get disable again automatically. Most organizations will disable the Gaming under Settings completely.

But if you want to still keep showing Gaming under Settings app and want to control Game mode using Intune then you can use the steps given in this blog post to easily manage this setting.

READ NEXT