PowerShell, Intune: How to disable teams GPU acceleration with Intune/GPO.

If your machine is suffering from unusually high CPU usage caused by Teams, even when you aren't using it. The chances are GPU acceleration needs to be disabled. This is easy on one machine but if you have hundreds then you need a script. Luckily most settings in Teams are configured in a handy json file located here:

C:\Users\<UserName>\AppData\Roaming\Microsoft\Teams\desktop-config.json

The following script will edit the json file and set Disable GPU acceleration to True. You could run this from a GPO, however I added it to Intune as a script via a deployment group.

<# Disable GPU acceleration in teams. #>
$FilePath = "C:\Users\"+ $env:UserName + "\AppData\Roaming\Microsoft\Teams\desktop-config.json"
$TeamsConfig = Get-Content $FilePath| Out-String | ConvertFrom-Json
$TeamsConfig.appPreferenceSettings.disableGpu = $True
$TeamsConfig | ConvertTo-Json -compress -depth 100 | Set-Content $FilePath -Force

<# Check status. #>
$CheckFilePath = "C:\Users\"+ $env:UserName + "\AppData\Roaming\Microsoft\Teams\desktop-config.json"
$CheckTeamsConfig = Get-Content $FilePath| Out-String | ConvertFrom-Json

<# Create log. #>
$Folder = 'C:\Temp'
$Time = get-date
if (Test-Path -Path $Folder) {
    Del C:\temp\TeamsDisableGPU.txt
    New-Item C:\temp\TeamsDisableGPU.txt
    Set-Content C:\temp\TeamsDisableGPU.txt $Time
    add-Content C:\temp\TeamsDisableGPU.txt $CheckTeamsConfig.appPreferenceSettings.disableGpu
    add-Content C:\temp\TeamsDisableGPU.txt $CheckFilePath

} else {
    mkdir c:\temp
    New-Item C:\temp\TeamsDisableGPU.txt
    Set-Content C:\temp\TeamsDisableGPU.txt $Time
    add-Content C:\temp\TeamsDisableGPU.txt $CheckTeamsConfig.appPreferenceSettings.disableGpu
    add-Content C:\temp\TeamsDisableGPU.txt $CheckFilePath
}

<#You need to delete this file for this to work#>
$cookieFile =  "$env:userprofile\AppData\Roaming\Microsoft\teams\Cookies"
Del $cookieFile

The script leaves a log:

C:\temp\TeamsDisableGPU.txt

Which will show you when it ran, the location of the file it edited and what it changed the field to. It should always be true.

Once the script has run you will need to restart teams.