diff --git a/Chrome Downloader.ps1 b/Chrome Downloader.ps1 index 185247f..ea0f92f 100644 --- a/Chrome Downloader.ps1 +++ b/Chrome Downloader.ps1 @@ -128,6 +128,12 @@ if ($config.options.enableForcedVersion) { } } -if ($config.options.enableNumberedVersion) { - & $PSScriptRoot\Rename.ps1 +# 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 diff --git a/README.md b/README.md index 07d9c21..44d7210 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ The script reads its configuration from a JSON file named `config.json` located - `enableRegularVersion`: Boolean flag to enable the downloading of the regular version of Chrome. - `enableForcedVersion`: Boolean flag to enable the downloading of the forced update version of Chrome. -- `enableNumberedVersion`: Boolean flag to enable the automatic renaming of the folder to the newest version of Chrome. +- `enableNumberedVersion`: Boolean flag to enable the automatic renaming of the folder to the newest version of Chrome **⚠️This config requires administrative privileges when executing the script!⚠️** - `logDateFormat`: A string defining the format of timestamps in log messages. #### Date Configuration