I found a workaround for UAC lag that you may want to consider incorporating into the script or adding as a note in the readme. Using group polices you can disable the dimming (secure desktop) that occurs when using UAC. While this is technically less secure, it is a good balance between outright disabling UAC and dealing with sustainable UAC lag.
Set "User Account Control: Behavior of the elevation prompt for administrators in Admin Approval Mode" from "Prompt for consent on the secure desktop" to "Prompt for consent".
Then change "User Account Control: Switch to the secure desktop when prompting for elevation" to "Disabled".
Nice find!
For me it was enough to just change the second policy you mentioned to disabled.
For anyone else who wants try it i will add some more information on where to find it:
Press Windows + R to open the Run dialog.
Type gpedit.msc and press Enter.
Navigate to the relevant setting: Go to Computer Configuration > Windows Settings > Security Settings > Local Policies > Security Options.
Find the setting "User Account Control: Switch to the secure desktop when prompting for elevation".
Double-click it, and change the value from "Enabled" to "Disabled."
I found a workaround for UAC lag that you may want to consider incorporating into the script or adding as a note in the readme. Using group polices you can disable the dimming (secure desktop) that occurs when using UAC. While this is technically less secure, it is a good balance between outright disabling UAC and dealing with sustainable UAC lag.