20 lines
789 B
PowerShell
20 lines
789 B
PowerShell
$script = $MyInvocation.MyCommand.Path
|
|
|
|
$isAdmin = [Security.Principal.WindowsPrincipal]::new([Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
|
|
if (-not $isAdmin) {
|
|
Write-Warning "Not running as administrator. Restarting with elevated privileges..."
|
|
Start-Process powershell -Verb RunAs -ArgumentList "-ExecutionPolicy Bypass -File `"$script`""
|
|
exit
|
|
}
|
|
|
|
try {
|
|
Remove-OdbcDsn -Name "GhOST Library" -DsnType "User" -Platform "64-bit"
|
|
Write-Host "`nSUCCESS: ODBC connection 'GhOST Library' removed." -ForegroundColor Green
|
|
}
|
|
catch {
|
|
Write-Host "`nERROR: $_" -ForegroundColor Red
|
|
}
|
|
|
|
Write-Host "`nPress any key to exit..." -ForegroundColor Yellow
|
|
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
|