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, it’s often best to keep this setting turned off in an enterprise environment. This blog post 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.
You can also directly deploy the PowerShell script via Intune to create these reg keys: Deploy a PowerShell Script using Intune. However, using Win32 app method, you can use a detection script for confirming the deployment status on Intune admin center.
Contents
1. Registry Keys to Disable Game Mode
To disable Game Mode on Windows 10 or 11 using Intune, ensure that both AllowAutoGameMode and AutoGameModeEnabled are of type REG_DWORD, and their values are set to 0.
2. Create a PowerShell script
- Create a PowerShell script Gamemode_O.ps1 and add the code as given below.
- Place the PowerShell script in a dedicated folder. For example: C:\GameOff_O. Ensure no other files or folders are inside the C:\GameOff_O directory, apart from the Gamemode_O.ps1 file.
Gamemode_O.ps1
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
3. Create an IntuneWin File
You can follow the below steps to create .IntuneWin file that will be used for the deployment.
- Create an empty folder, for example, C:\output, or anywhere else.
- Download Microsoft Win32 Content Prep Tool. It’s a zip file; therefore, extract its contents into a folder.
- Repackage the application folder C:\GameOff_O to .intunewin file using IntuneWinAppUtil.exe.
Use the below command to create an 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
Once the command has finished, you can verify the creation of the .intunewin file in the C:\Output folder. As seen in the following steps, we will use this .intunewin file to set up the Win32 app deployment.
For more details about creating an Intunewin file, please refer to the post: How to create an IntuneWin file.
4. Create an App deployment on Intune
Now, we have an app packaged into the Intunewin file, let’s check the deployment steps:
- Sign in to the Intune admin center > Apps > All Apps.
- Click on + Add and Select Windows app (Win32) from the app type.
- App Information: Click on Select app package file and browse to .Intunewin file. Provide Information in the mandatory fields. The rest of the fields are optional but useful for application documentation and troubleshooting issues.
- Program Tab:
- 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 to deploy the app. If your devices mix 32-bit and 64-bit types, check the boxes for 32-bit and 64-bit in the operating system architecture drop-down. Else, go with 64-bit.
- Operating System Architecture: 64-bit
- Minimum operating system: Select the minimum OS requirement for this deployment.
- Detection Rules: We’ll use a custom detection script to ensure that both registry keys exist and have their values set to 0. 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, call it GamekeysDetect.ps1.
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.
- Assignments Tab: Click Add groups and add an Entra security group containing Windows 10/11 devices.
- Review + create: Review the deployment and click on Create.
Monitoring Deployment Progress
- 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 from the device itself or remotely through the Intune admin center.
Alternatively, you can use PowerShell to force the Intune sync on Windows devices. Restarting the device is another way to trigger the Intune device check-in process.
End User Experience
- 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.
I used this to successfully disable Gamebar under a specific user but I am getting failure errors under the bulk of the users. Any idea why this would occur? The error code given is 0x800704EC