← Files Power BI DesktopARCHIVED FILE

scripts/Uninstall-PowerBIExternalTool.ps1

795 Bytes · Oct 2, 2026 · 00:32 UTC

↓ Download file

param(
    [string]$Name = 'Codex Power BI Workbench',
    [switch]$Json
)

$ErrorActionPreference = 'Stop'

$installDirectory = Join-Path $env:CommonProgramFiles 'Microsoft Shared\Power BI Desktop\External Tools'
$fileName = ($Name -replace '[\\/:*?"<>|]', '').Trim()
if (-not $fileName) { $fileName = 'Codex Power BI Workbench' }
$targetPath = Join-Path $installDirectory ($fileName + '.pbitool.json')
$existed = Test-Path -LiteralPath $targetPath
if ($existed) {
    Remove-Item -LiteralPath $targetPath -Force
}

$result = [pscustomobject]@{
    schema = 'codex.powerbi.externalToolUninstall.v1'
    removed = $existed
    targetPath = $targetPath
    requiresPowerBIRestart = $existed
}

if ($Json) {
    $result | ConvertTo-Json -Depth 5
    return
}

$result

SHA-256: f2c3f823031f7d4b3038ddc647852aa5f4d3586fce1251ccd671b4cd28434128