LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

If you run the installer "Run as Administrator", executable runs with elevated rights?

Solved!
Go to solution

Hello,

 

LV installer has selected "Run executable at end of installation".
If you run the installer "Run as Administrator", the executable runs with elevated rights?

 

Best Regards

0 Kudos
Message 1 of 11
(10,429 Views)

I haven't tested this but I'm almost certain it would not work that way.  When you run an installer with elevated privileges that is limited to that executable being ran, which is the setup EXE.  After that is installed running the EXE it installs shouldn't do anything different.

 

One possible work around is you can run an application, as if you were another user.  There is the command line Run As, which I think can save credentials so you aren't prompted.

 

http://www.sevenforums.com/tutorials/419-run-different-user.html

 

Or there is another command line program that you provide the user name and password as plain text which can be a security issue.

 

https://technet.microsoft.com/en-us/sysinternals/psexec.aspx

 

Using either of these you can make a shortcut that runs your program as a different user.

0 Kudos
Message 2 of 11
(10,407 Views)

Starting from your links, I found this solution:

http://www.sevenforums.com/tutorials/316-compatibility-mode.html

 

1. Before running the .exe file, edit the registry:
-path: HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows NT \ CurrentVersion \ AppCompatFlags \ Layers
Name: "full path to the file .exe"
Data: "RUNASADMIN"
2. Run the .exe file using SystemExec.vi
3. After the .exe program, delete the registry value created (optional)

The only problem might be that modifying the registry key, 😞 require elevated privileges.

I have a lot of digging ...

 

BR

0 Kudos
Message 3 of 11
(10,382 Views)

Embed a windows manifest file telling windows the executable needs elevated rights:

 

manifest.PNG

 

http://digital.ni.com/public.nsf/allkb/E06C1800F5AFCCBF86257236006C9F2A

 

Message 4 of 11
(10,362 Views)
Embedding a manifest file still requires you have elevated rights to run the program though (e.g. by being logged in as an administrator or by having to enter administrator UAC credentials before it will launch).

The suggestion that Hooovahh made is the only one that I know of except that if you have a part of your program that requires admin rights, you could run it as a service (which has SYSTEM admin rights).

LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 5 of 11
(10,337 Views)

I want to realize an installer for my software and I need to write some registry keys, to extract information about PC HW and OS and to set some .ini files. Another reason I want to do this installer is that the software contains several modules (.exe file). The user can select which modules are to be installed. Some modules require access to registry keys. For these reasons I have to make an installer and create solutions to access "as administrator" registry keys for different software modules.
I want to realize this installer to be launched after installing LVRT execution and run with elevated rights.

 

BR

 

 

0 Kudos
Message 6 of 11
(10,314 Views)
Solution
Accepted by topic author Marinica
My apologies - when configure your installer to 'run executable at end of installation', it will run that executable with admin rights because the installer itself requires admin rights.

The LabVIEW installer can create registry keys for you.

For your more advanced customisation (e.g. selecting modules), you would need to look at using a different installer solution (e.g. InnoSetup) or you'd need to write an executable in LabVIEW that you can run after the install which allows you to select the installers you want and run them using System Exec.

LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 7 of 11
(10,306 Views)

I followed the instructions from the NI notice in order to extract .manifet file (see attachment) but the .manifest file has not appeared in the application directory.
I do not have the SDK installed. But I downloaded mt.exe file and copied to the folder Windows \ system32. Let this be the problem? I need to install the complete SDK?

 

BR

0 Kudos
Message 8 of 11
(10,294 Views)

I managed to extract the manifest file from setup.exe (created with LV installer). The solution is:
C:> mt.exe -inputresource:"<full path>\<application>.exe" -out:"<full path>\<application>.manifest"
instead of
C:>mt.exe -inputresource:"<full path>\<application>.exe" -out:<application>.manifest

 

BR

0 Kudos
Message 9 of 11
(10,277 Views)

Thank you.
The .exe file launched by the installer, "Run as Administrator".


Now I want to dig on the .manifest files.
I managed to extract a .manifest file from the installer (setup.exe). I tried to embed the .manifest file in my application and building went OK. When I launched my .exe file, Windows display the window to allow ... meaning that it try to "Run as Administrator". After my confirmation, Windows display an error and the file was not run. I rebuilt the application without manifest file and everything returned to normal.

 

Does anyone know how to create a simple .manifest file, that only allowing the running application "Run as Administrator"?

 

BR

0 Kudos
Message 10 of 11
(10,236 Views)