Hi everyone,
We have an issue where I'm trying to set an .exe default settings to be run in admin mode with some additional compatibility settings configured. Usually we would set it via the following:
However, this doesn't get set correctly if the user that runs the installer is a non-admin user due to the permissions requiring an admin to install and therefore the HKEY_CURRENT_USER uses the admin user used to install it rather than the user who will run it.
I have tried to change the HKEY to HKEY_LOCAL_MACHINE and even HKEY_USERS using the .Defaults folder but those don't seem to help either...
Thanks in advance!
We have an issue where I'm trying to set an .exe default settings to be run in admin mode with some additional compatibility settings configured. Usually we would set it via the following:
Code:
-- Run .exe as Admin or Compatibility os_name = System.GetOSName(); -- Display the name of the OS in a dialog. --Dialog.Message("Information", "Your operating system is "..os_name..".", MB_OK, MB_ICONINFORMATION); if (os_name == "Windows 7" or os_name == "Windows 8" or os_name == "Windows 8.1" or os_name == "Windows 10") then if (not Registry.DoesKeyExist(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers")) then -- create the key for storing the flag Registry.CreateKey(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers"); end -- create AppCompatFlag in HKCU Registry.SetValue(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers", SessionVar.Expand("%AppFolder%\\EXEName.exe" ), "~ RUNASADMIN HIGHDPIAWARE", REG_SZ); end
I have tried to change the HKEY to HKEY_LOCAL_MACHINE and even HKEY_USERS using the .Defaults folder but those don't seem to help either...
Thanks in advance!
Comment