diff --git a/Chrome Downloader.ps1 b/Chrome Downloader.ps1 index f834628..051152b 100644 --- a/Chrome Downloader.ps1 +++ b/Chrome Downloader.ps1 @@ -128,12 +128,14 @@ if ($config.options.enableForcedVersion) { } } -# Check if the script is running with administrative privileges -if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { - Log-Message "Error: the config 'enableNumberedVersion' requires administrative privileges to run." -} -else { - if ($config.options.enableNumberedVersion) { - & $PSScriptRoot\Rename.ps1 - } +if ($config.options.enableNumberedVersion) { + # Check if the script is running with administrative privileges + if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { + Log-Message "Error: the config 'enableNumberedVersion' requires administrative privileges to run." + } + else { + if ($config.options.enableNumberedVersion) { + & $PSScriptRoot\Rename.ps1 + } + } } \ No newline at end of file