Ask for admin rights in Powershell
This commit is contained in:
34
install.ps1
34
install.ps1
@@ -2,6 +2,28 @@ Set-StrictMode -Version Latest
|
|||||||
$ErrorActionPreference = "Stop"
|
$ErrorActionPreference = "Stop"
|
||||||
$ProgressPreference = "SilentlyContinue"
|
$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_NAME = "uwu2x-pro"
|
||||||
$EXT_VERSION = "8.7"
|
$EXT_VERSION = "8.7"
|
||||||
$ZIP_URL = "https://cloud.alixz.ovh/f/uwu2x-$EXT_VERSION-win.zip"
|
$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"
|
$SYSTEM_EXT_DIR = "C:\Program Files (x86)\Common Files\Adobe\CEP\extensions"
|
||||||
|
|
||||||
if (Get-Process -Name "AfterFX" -ErrorAction SilentlyContinue) {
|
if (Get-Process -Name "AfterFX" -ErrorAction SilentlyContinue) {
|
||||||
Write-Host "After Effects is currently running."
|
Write-Host "After Effects is currently running." -ForegroundColor Red
|
||||||
Write-Host "Please close it and run the installer again."
|
Write-Host "Please close it and run the installer again." -ForegroundColor Red
|
||||||
Read-Host "Press Enter to exit..."
|
Read-Host "Press Enter to exit..."
|
||||||
Exit 1
|
Exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,5 +77,7 @@ Copy-Item -Recurse -Force $SRC $TARGET_DIR
|
|||||||
|
|
||||||
Remove-Item -Recurse -Force $TMP_DIR
|
Remove-Item -Recurse -Force $TMP_DIR
|
||||||
|
|
||||||
Write-Host "Installation completed successfully."
|
Write-Host "Installation completed successfully." -ForegroundColor Green
|
||||||
Write-Host "You can now launch After Effects."
|
Write-Host "You can now launch After Effects." -ForegroundColor Green
|
||||||
|
|
||||||
|
Read-Host "Press Enter to exit..."
|
||||||
Reference in New Issue
Block a user