Metall4You
Posts: 16
Joined: Sun Jan 03, 2010 9:25 am

Run VB EXE-File in Administrator Mode on Vista

Hello

How can i set in the install procedure the Adminitrator Mode for the EXE-File for Vista? After install finish, the Programm sould automatik run in Administrator Mode. I'm use Profesionall Install..................

BRGDS Ramon
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Run VB EXE-File in Administrator Mode on Vista

Hi Ramon,

If you are looking for running your executable as administrator, make sure you add it as a custom action with the "deferred with no impersonation" option enabled. Also, make sure you have "Per machine if user is administrator, per user otherwise" option enabled on the Install Parameters page.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
Metall4You
Posts: 16
Joined: Sun Jan 03, 2010 9:25 am

Re: Run VB EXE-File in Administrator Mode on Vista

Hi Gabriel

I can't find "custom action with the "deferred with no impersonation" option"

pls confirm

Ramon
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Run VB EXE-File in Administrator Mode on Vista

Hi Ramon,

- On the custom actions page, right click->New Attached Custom Action.
- Select your VB file.
- once added to the list, you will find the "Deferred with no impersonation" option in the right pane, under the Execution Options section.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
Metall4You
Posts: 16
Joined: Sun Jan 03, 2010 9:25 am

Re: Run VB EXE-File in Administrator Mode on Vista

Hi Gabriel

thats not that what i need. i would like to mark the shortcut with the exefile with run at in administrator mode in the properties. now the program runs in the install procedure. my programm runs only in the administrator mode after the install...

"Run this program as an administrator", and then click OK in the properties

any idee

brgds ramon
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Run VB EXE-File in Administrator Mode on Vista

Hello,

From the Registry page, please create a registry entry in this location:
[HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers]
The entry should be a new REG_SZ string value and its name should be the path to your exe file (e.g "C:\Program Files\Notepad++\notepad++.exe") with the data RUNASADMIN.
This should do the trick, let us know how it turned out.

Regards,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Metall4You
Posts: 16
Joined: Sun Jan 03, 2010 9:25 am

Re: Run VB EXE-File in Administrator Mode on Vista

Hi Mihai

Thanks, that works very well, but when the path not is the Root Directory "C:\" ? (e.g "C:\Program Files\Notepad++\notepad++.exe")

Can i set that with the install rutine to maby "D:\"?

BRGDS

Ramon
Bogdan
Posts: 2791
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Run VB EXE-File in Administrator Mode on Vista

Hi Ramon,

This can be done in the GUI of Advanced Installer, simply go to Registry page and edit the registry value that contains the path to your EXE.
Instead of a hard-coded path you can use a reference for the file, something like "[#myfile.exe]".

Please note that this reference is automatically generated by Advanced Installer GUI, you must not write it manually.

At run-time this will resolve to the entire installation path of the file.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Metall4You
Posts: 16
Joined: Sun Jan 03, 2010 9:25 am

Re: Run VB EXE-File in Administrator Mode on Vista

Hi Bogdan

Something like that

"C:\ProgramData\EasyMet\#easymet.exe" or simple

#easymet.exe

BRGDS

Ramon
Bogdan
Posts: 2791
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Run VB EXE-File in Administrator Mode on Vista

Hi,

The simple version, but with square brackets. Use the support included in Advanced Installer to generate the reference, as in the attached picture.

Regards,
Bogdan
Attachments
file reference.jpg
file reference.jpg (39.82 KiB) Viewed 29465 times
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Metall4You
Posts: 16
Joined: Sun Jan 03, 2010 9:25 am

Re: Run VB EXE-File in Administrator Mode on Vista

Hi Bogdan

With this Propertie is not run in admin mode with c:\program files\easymet\easymet.exe

Is that correct so [#EasyMet.exe]RUNASADMIN..........?

BRGDS Ramon
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Run VB EXE-File in Administrator Mode on Vista

Hi Ramon,

Actually, you can reference your file in the "Name:" formatted field and the "Data:" text field should type only RUNASADMIN, just like in the following screenshot :
registry.jpg
registry.jpg (32.76 KiB) Viewed 29424 times
Let me know how it works for you.

Best Regards,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Bogdan
Posts: 2791
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Run VB EXE-File in Administrator Mode on Vista

Hi Ramon,

Another solution, recommended by Microsoft, to launch the file as administrator is to embed an application manifest within your program that tells the operating system what the application needs.
In the following article you can find more details about how to create this manifest file.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”