Update Visual Studio Code Updates Settings with PowerShell

By | 2022-Jun-02

On Windows systems, Visual Studio Code settings are stored in a subfolder of the User profile.

%APPDATA%\Code\User\settings.json

There is no global settings file, so if you are deploying in an enterprise environment where updates are managed with something like Microsoft Endpoint Manager (Intune), you might wish to disable VSCode’s update check so it doesn’t nag your users who may not have the ability to install the update.

This block of PowerShell iterates through C:\Users looking for VSCode settings files in the Users’ profiles. If it finds one, it adds or updates update.mode:none.

ForEach ($user in (Get-ChildItem -Path "C:\Users")) {
        $jsonPath = "C:\Users\" + $user.Name + "\AppData\Roaming\Code\User\settings.json"
        If (Test-Path "$jsonPath") {
            $json = Get-Content "$jsonPath" -Raw | ConvertFrom-Json
            $json | Add-Member -Force -MemberType NoteProperty -Name "update.mode" -Value "none"
            $json | ConvertTo-Json | Out-File "$jsonPath" -Encoding utf8
        }
    }