From cf9911a8a07c4767091f9725565db8022c0d0282 Mon Sep 17 00:00:00 2001 From: Yuri Gabriel <97139700+Yuuh15@users.noreply.github.com> Date: Wed, 21 Feb 2024 21:56:18 -0300 Subject: [PATCH] Now it works --- config/tweaks.json | 31 ++++++++++--------------------- winutil.ps1 | 33 ++++++++++++--------------------- 2 files changed, 22 insertions(+), 42 deletions(-) diff --git a/config/tweaks.json b/config/tweaks.json index aac5f5f0..bc8a6796 100644 --- a/config/tweaks.json +++ b/config/tweaks.json @@ -2553,29 +2553,18 @@ "panel": "1", "Order": "a031_", "InvokeScript": [ - " - New-Item -Path \"Registry::HKCR:\\*\\shell\\runas\" -Force | Out-Null - Set-ItemProperty -Path \"Registry::HKCR:\\*\\shell\\runas\" -Name \"(default)\" -Value 'Take Ownership' - Set-ItemProperty -Path \"Registry::HKCR:\\*\\shell\\runas\" -Name \"NoWorkingDirectory\" -Value '' - - New-Item -Path \"Registry::HKCR:\\*\\shell\\runas\\command\" -Force | Out-Null - Set-ItemProperty -Path \"Registry::HKCR:\\*\\shell\\runas\\command\" -Name \"(default)\" -Value 'cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F' - Set-ItemProperty -Path \"Registry::HKCR:\\*\\shell\\runas\\command\" -Name \"IsolatedCommand\" -Value 'cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F' - - New-Item -Path \"Registry::HKCR:\\Directory\\shell\\runas\" -Force | Out-Null - Set-ItemProperty -Path \"Registry::HKCR:\\Directory\\shell\\runas\" -Name \"(default)\" -Value 'Take Ownership' - Set-ItemProperty -Path \"Registry::HKCR:\\Directory\\shell\\runas\" -Name \"NoWorkingDirectory\" -Value '' - - New-Item -Path \"Registry::HKCR:\\Directory\\shell\\runas\\command\" -Force | Out-Null - Set-ItemProperty -Path \"Registry::HKCR:\\Directory\\shell\\runas\\command\" -Name \"(default)\" -Value 'cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t' - Set-ItemProperty -Path \"Registry::HKCR:\\Directory\\shell\\runas\\command\" -Name \"IsolatedCommand\" -Value 'cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t' - " + "reg add \"HKCR\\*\\shell\\runas\" /ve /d \"Take Ownership\" /f", + "reg add \"HKCR\\*\\shell\\runas\" /v \"NoWorkingDirectory\" /d \"\" /f", + "reg add \"HKCR\\*\\shell\\runas\\command\" /ve /d \"cmd.exe /c takeown /f '%1' && icacls '%1' /grant administrators:F\" /f", + "reg add \"HKCR\\*\\shell\\runas\\command\" /v \"IsolatedCommand\" /d \"cmd.exe /c takeown /f '%1' && icacls '%1' /grant administrators:F\" /f", + "reg add \"HKCR\\Directory\\shell\\runas\" /ve /d \"Take Ownership\" /f", + "reg add \"HKCR\\Directory\\shell\\runas\" /v \"NoWorkingDirectory\" /d \"\" /f", + "reg add \"HKCR\\Directory\\shell\\runas\\command\" /ve /d \"cmd.exe /c takeown /f '%1' /r /d y && icacls '%1' /grant administrators:F /t\" /f", + "reg add \"HKCR\\Directory\\shell\\runas\\command\" /v \"IsolatedCommand\" /d \"cmd.exe /c takeown /f '%1' /r /d y && icacls '%1' /grant administrators:F /t\" /f" ], "UndoScript": [ - " - Remove-Item -Recurse -Force -ErrorAction SilentlyContinue -Path \"Registry::HKCR:\\*\\shell\\runas\" - Remove-Item -Recurse -Force -ErrorAction SilentlyContinue -Path \"Registry::HKCR:\\Directory\\shell\\runas\" - " + "reg delete \"HKCR\\*\\shell\\runas\" /f", + "reg delete \"HKCR\\Directory\\shell\\runas\" /f" ] }, "WPFToggleDarkMode": { diff --git a/winutil.ps1 b/winutil.ps1 index 79a668b5..c6ceb9fd 100644 --- a/winutil.ps1 +++ b/winutil.ps1 @@ -10,6 +10,7 @@ Author : Chris Titus @christitustech Runspace Author: @DeveloperDurp GitHub : https://github.com/ChrisTitusTech + Version : 24.02.21 #> param ( [switch]$Debug, @@ -46,6 +47,7 @@ Add-Type -AssemblyName System.Windows.Forms # Variable to sync between runspaces $sync = [Hashtable]::Synchronized(@{}) $sync.PSScriptRoot = $PSScriptRoot +$sync.version = "24.02.21" $sync.configs = @{} $sync.ProcessRunning = $false @@ -10627,29 +10629,18 @@ $sync.configs.tweaks = '{ "panel": "1", "Order": "a031_", "InvokeScript": [ - " - New-Item -Path \"Registry::HKCR:\\*\\shell\\runas\" -Force | Out-Null - Set-ItemProperty -Path \"Registry::HKCR:\\*\\shell\\runas\" -Name \"(default)\" -Value ''Take Ownership'' - Set-ItemProperty -Path \"Registry::HKCR:\\*\\shell\\runas\" -Name \"NoWorkingDirectory\" -Value '''' - - New-Item -Path \"Registry::HKCR:\\*\\shell\\runas\\command\" -Force | Out-Null - Set-ItemProperty -Path \"Registry::HKCR:\\*\\shell\\runas\\command\" -Name \"(default)\" -Value ''cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F'' - Set-ItemProperty -Path \"Registry::HKCR:\\*\\shell\\runas\\command\" -Name \"IsolatedCommand\" -Value ''cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F'' - - New-Item -Path \"Registry::HKCR:\\Directory\\shell\\runas\" -Force | Out-Null - Set-ItemProperty -Path \"Registry::HKCR:\\Directory\\shell\\runas\" -Name \"(default)\" -Value ''Take Ownership'' - Set-ItemProperty -Path \"Registry::HKCR:\\Directory\\shell\\runas\" -Name \"NoWorkingDirectory\" -Value '''' - - New-Item -Path \"Registry::HKCR:\\Directory\\shell\\runas\\command\" -Force | Out-Null - Set-ItemProperty -Path \"Registry::HKCR:\\Directory\\shell\\runas\\command\" -Name \"(default)\" -Value ''cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t'' - Set-ItemProperty -Path \"Registry::HKCR:\\Directory\\shell\\runas\\command\" -Name \"IsolatedCommand\" -Value ''cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t'' - " + "reg add \"HKCR\\*\\shell\\runas\" /ve /d \"Take Ownership\" /f", + "reg add \"HKCR\\*\\shell\\runas\" /v \"NoWorkingDirectory\" /d \"\" /f", + "reg add \"HKCR\\*\\shell\\runas\\command\" /ve /d \"cmd.exe /c takeown /f ''%1'' && icacls ''%1'' /grant administrators:F\" /f", + "reg add \"HKCR\\*\\shell\\runas\\command\" /v \"IsolatedCommand\" /d \"cmd.exe /c takeown /f ''%1'' && icacls ''%1'' /grant administrators:F\" /f", + "reg add \"HKCR\\Directory\\shell\\runas\" /ve /d \"Take Ownership\" /f", + "reg add \"HKCR\\Directory\\shell\\runas\" /v \"NoWorkingDirectory\" /d \"\" /f", + "reg add \"HKCR\\Directory\\shell\\runas\\command\" /ve /d \"cmd.exe /c takeown /f ''%1'' /r /d y && icacls ''%1'' /grant administrators:F /t\" /f", + "reg add \"HKCR\\Directory\\shell\\runas\\command\" /v \"IsolatedCommand\" /d \"cmd.exe /c takeown /f ''%1'' /r /d y && icacls ''%1'' /grant administrators:F /t\" /f" ], "UndoScript": [ - " - Remove-Item -Recurse -Force -ErrorAction SilentlyContinue -Path \"Registry::HKCR:\\*\\shell\\runas\" - Remove-Item -Recurse -Force -ErrorAction SilentlyContinue -Path \"Registry::HKCR:\\Directory\\shell\\runas\" - " + "reg delete \"HKCR\\*\\shell\\runas\" /f", + "reg delete \"HKCR\\Directory\\shell\\runas\" /f" ] }, "WPFToggleDarkMode": {