Fixed a flaw in the admin check
This commit is contained in:
parent
6aa29dbf34
commit
97af9654c9
1 changed files with 10 additions and 8 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue