Force a command without UAC elevation in PowerShell

The version of Darktable in the scoop extras bucket was very old, because of the new exe file distribution. I wanted to improve that. One of the biggest problem was to get rid of the UAC elevation asked by the NSIS installation script, which was quite useless with the use of another folder than the default one.

A google search gives as a result that you can force no UAC elevation with RunAsInvoker. Under cmd.exe it would be :

As scoop run in PowerShell, here is the PowerShell version  :

In the scoop script, another difficulty is to get the proper variable substitution. To do so, you will need to use Invoke-Expression :

Doing so it won’t wait for the installation to be done. A simple way to wait for completion is to add a pipe to Out-Null. Indeed, with a pipe, it will force PowerShell to wait the end of the first process! So the final string, with proper quote escaping is :


References :

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.