Files
mars-elt/dbt/dxc/remove_dbt_env_variables.ps1
Grzegorz Michalski 2c225d68ac init
2026-03-02 09:47:35 +01:00

39 lines
2.4 KiB
PowerShell

# Script to remove DBT environment variables permanently from User scope
# Run this script to clean up all DBT-related environment variables
Write-Host "Removing DBT environment variables for all targets..." -ForegroundColor Red
Write-Host "It can runs slowly, please wait with patience ..." -ForegroundColor Red
Write-Host ""
# POC Environment
Write-Host "Removing POC environment variables..." -ForegroundColor Yellow
[System.Environment]::SetEnvironmentVariable('DBT_PROFILE_TARGET_TYPE_POC', $null, 'User')
[System.Environment]::SetEnvironmentVariable('DBT_PROFILE_TARGET_HOST_POC', $null, 'User')
[System.Environment]::SetEnvironmentVariable('DBT_PROFILE_TARGET_USER_POC', $null, 'User')
[System.Environment]::SetEnvironmentVariable('DBT_PROFILE_TARGET_PASSWORD_POC', $null, 'User')
[System.Environment]::SetEnvironmentVariable('DBT_PROFILE_TARGET_PORT_POC', $null, 'User')
[System.Environment]::SetEnvironmentVariable('DBT_DATABASE_NAME_POC', $null, 'User')
[System.Environment]::SetEnvironmentVariable('DBT_PROFILE_TARGET_SERVICE_NAME_POC', $null, 'User')
# DEV Environment
Write-Host "Removing DEV environment variables..." -ForegroundColor Yellow
[System.Environment]::SetEnvironmentVariable('DBT_PROFILE_TARGET_TYPE_DEV', $null, 'User')
[System.Environment]::SetEnvironmentVariable('DBT_PROFILE_TARGET_HOST_DEV', $null, 'User')
[System.Environment]::SetEnvironmentVariable('DBT_PROFILE_TARGET_USER_DEV', $null, 'User')
[System.Environment]::SetEnvironmentVariable('DBT_PROFILE_TARGET_PASSWORD_DEV', $null, 'User')
[System.Environment]::SetEnvironmentVariable('DBT_PROFILE_TARGET_PORT_DEV', $null, 'User')
[System.Environment]::SetEnvironmentVariable('DBT_DATABASE_NAME_DEV', $null, 'User')
[System.Environment]::SetEnvironmentVariable('DBT_PROFILE_TARGET_SERVICE_NAME_DEV', $null, 'User')
Write-Host ""
Write-Host "All environment variables have been removed successfully!" -ForegroundColor Green
Write-Host ""
Write-Host "IMPORTANT: You need to restart PowerShell for changes to take effect." -ForegroundColor Yellow
Write-Host ""
Write-Host "To verify, open a NEW PowerShell window and run:" -ForegroundColor Yellow
Write-Host " Get-ChildItem Env: | Where-Object Name -like 'DBT_*'" -ForegroundColor White
Write-Host ""
Write-Host "Expected result: No variables should be found." -ForegroundColor White