How NOT to elevate an installer application in Vista 

Like many others I had problems installing softwares in my Vista(Business) laptop since long as it always forces me to install it with Admin authority, which I didn’t want! I just wanted to install a software or a program for a testing purpose some of which didn’t even need to register in the windows registry.

Vista has a way to force the setup programs to elevate the current user if the user is not the administrator. That way Vista ensures the security of the system, at least that’s what there defenses are.

But in order to install my programs without elevating my user credentials, I searched the web with the help of Google Search and landed on a helpful msdn blog of Andrew Arnott

The important bit of code that helped me at the moment was the following:

There is a way to coerce Vista to not elevate a process that it otherwise would.

REM The next command MUST be run from an elevated command window.
REM It launches regedit.exe WITHOUT elevated privileges.
runas /trustlevel:0x20000 regedit.exe

I have modified it to take a parameter that would help you run this for any program from an elevated command prompt

Here is what is done to do the job:

@ECHO OFF
REM =====================================
REM source: http://blogs.msdn.com/andrewarnottms/archive/2008/10/15/how-to-force-vista-to-not-elevate-an-application.aspx
REM =====================================
REM The next command MUST be run from an elevated command window.
REM It launches regedit.exe WITHOUT elevated privileges.
REM runas /trustlevel:0x20000 regedit.exe
REM =====================================
setlocal
if {%1}=={} set _empty=Syntax: UnUAC "[-e{xit current window}] [path\]file to run" &goto :message
if EXIST %~$PATH:1 (set _File=%~$PATH:1) ELSE (set _File=%~f1)
if NOT EXIST %_File% ( set _empty=File NOT found in the path or in local directory. &goto :message )
goto :runthis
:message
echo %_empty%
endlocal&set _empty=%_empty%
:runthis
if exist %_File% runas /trustlevel:0x20000 %_File%

I have saved it as UnUAC.cmd in the folder c:\Windows\System32\. That way it remains available at all levels and under any directory path. That’s how I’d be able to run any application without the admin elevation of the user ;)