private/Test-InstallVSCodeInsiders.ps1

function Test-InstallVSCodeInsiders {
    <#
    .SYNOPSIS
        Tests whether Visual Studio Code Insiders is installed
 
    .DESCRIPTION
        Checks the known per-user and system-wide Code - Insiders.exe paths. If
        neither file exists, searches the machine and current-user uninstall
        registry for the Visual Studio Code Insiders display name. Returns
        $true when any method finds an installation; otherwise, returns $false.
 
    .EXAMPLE
        PS> Test-InstallVSCodeInsiders
 
        Tests known paths and uninstall registry entries for Visual Studio Code
        Insiders.
 
    .INPUTS
        None. This function does not accept pipeline input.
 
    .OUTPUTS
        System.Boolean. Returns $true when Visual Studio Code Insiders is
        detected; otherwise, returns $false.
 
    .NOTES
        Author: David Segura
        Company: Recast Software
        Version: 1.0.0
        Date: 2026-08-28
 
    .LINK
        Test-CommandVSCodeInsiders
    #>

    [OutputType([bool])]
    param ()

    # Fast path — known install locations
    $knownPaths = @(
        (Join-Path $env:LOCALAPPDATA 'Programs\Microsoft VS Code Insiders\Code - Insiders.exe'),
        (Join-Path $env:ProgramFiles  'Microsoft VS Code Insiders\Code - Insiders.exe')
    )
    foreach ($path in $knownPaths) {
        if (Test-Path -Path $path) { return $true }
    }

    # Registry fallback
    $regPaths = @(
        'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*',
        'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*',
        'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*'
    )

    foreach ($regPath in $regPaths) {
        $entry = Get-ItemProperty -Path $regPath -ErrorAction SilentlyContinue |
            Where-Object { $_.PSObject.Properties['DisplayName'] -and $_.DisplayName -like 'Microsoft Visual Studio Code Insiders' } |
            Select-Object -First 1
        if ($entry) { return $true }
    }

    return $false
}