Ask for admin rights in Powershell

This commit is contained in:
2026-02-20 15:48:41 +01:00
parent 876d1a3cf6
commit 556dd357bc

View File

@@ -2,6 +2,28 @@ Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$ProgressPreference = "SilentlyContinue"
if ( -not (
(New-Object Security.Principal.WindowsPrincipal(
[Security.Principal.WindowsIdentity]::GetCurrent()
)).IsInRole(
[Security.Principal.WindowsBuiltInRole]::Administrator
)
)) {
try {
Start-Process `
-FilePath 'powershell' `
-ArgumentList ('-File', $MyInvocation.MyCommand.Source, $args | %{ $_ }) `
-Verb RunAs
exit
}
catch {
Write-Host "Administrator permission is required to install this extension." -ForegroundColor Red
Read-Host "Press Enter to exit..."
exit 1
}
}
$EXT_NAME = "uwu2x-pro"
$EXT_VERSION = "8.7"
$ZIP_URL = "https://cloud.alixz.ovh/f/uwu2x-$EXT_VERSION-win.zip"
@@ -11,9 +33,9 @@ $USER_EXT_DIR = "$env:APPDATA\Adobe\CEP\extensions"
$SYSTEM_EXT_DIR = "C:\Program Files (x86)\Common Files\Adobe\CEP\extensions"
if (Get-Process -Name "AfterFX" -ErrorAction SilentlyContinue) {
Write-Host "After Effects is currently running."
Write-Host "Please close it and run the installer again."
Read-Host "Press Enter to exit..."
Write-Host "After Effects is currently running." -ForegroundColor Red
Write-Host "Please close it and run the installer again." -ForegroundColor Red
Read-Host "Press Enter to exit..."
Exit 1
}
@@ -55,5 +77,7 @@ Copy-Item -Recurse -Force $SRC $TARGET_DIR
Remove-Item -Recurse -Force $TMP_DIR
Write-Host "Installation completed successfully."
Write-Host "You can now launch After Effects."
Write-Host "Installation completed successfully." -ForegroundColor Green
Write-Host "You can now launch After Effects." -ForegroundColor Green
Read-Host "Press Enter to exit..."