In short, you need to compile script into an .exe and modify the executable with uiAccess property set to true, digitally sign it and finally, put it in Program files directory.
Modifying the manifest
- Extract existing executable’s manifest:
mt.exe -inputresource:\path\to\.exe;#1 -outputresource:\path\to\manifest
- Open the manifest file in notepad and set uiAccess property to “true”
- Update the executable with new manifest:
mt.exe -manifest \path\to\manifest -outputresource:\path\to\exe#1
Signing the exe
Needs a valid certificate. On linux:
osslsigncode sign -certs <cert-file> -key <der-key-file> \
-n "Your Application" -i http://www.yourwebsite.com/ \
-in yourapp.exe -out yourapp-signed.exe
On Windows:
signtool sign /tr http://timestamp.digicert.com /td sha256 \
/fd sha256 /f <pfx-file> yourapp.exe
Placing the exe at the correct location
UI access is only granted for programs that are located under “Program Files” and “System32” directories.
External reference:
Enable interaction with administrative programs – Scripts and Functions – AutoHotkey Community
Step 6: Create and Embed an Application Manifest (UAC) | Microsoft Learn
Leave a Reply