From edd97b991fe9e5f5760c0f0cf3d6cdd92cc8e247 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Thu, 29 Jun 2023 02:54:09 +0200 Subject: [PATCH] Fix incorrect script --- scripts/Windows/OS/User.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/Windows/OS/User.ps1 b/scripts/Windows/OS/User.ps1 index 7c024a0d..edd5d1de 100644 --- a/scripts/Windows/OS/User.ps1 +++ b/scripts/Windows/OS/User.ps1 @@ -84,13 +84,14 @@ function Set-UACState([bool] $value) { function Enable-UACNextLogin([Context] $context) { Set-UACState $true; + $key = Get-SystemPolicyKey; $action = New-ScheduledTaskAction -Execute "pwsh.exe" -Argument ( [string]::Join( " ", @( "-c", - "Set-ItemProperty '$keyPath' -Name '$propertyName' -Value 0;", + "Set-ItemProperty '$($key.PSPath)' -Name 'EnableLUA' -Value 0;", "Unregister-ScheduledTask -Force '$uacDisablerName';", ". '$PSScriptRoot/../Scripts/Context.ps1';", "`$context = [Context]::new();",