Let your installer run as an administrator

You need to ask for the permission to execute the script, and you can set the MsiBootstrapper property to TRUE as below description.

Typically, Setup.exe (also known as the bootstrapper) does not run as elevated; it runs at the current user's permission level. Therefore, the installation does not prompt for elevation when the final application installation starts. However, note that an .msi file usually prompts the user, whereas Setup.exe does not.

In the embedded UAC manifest of the bootstrapper, the requestedExecutionLevel node specifies that the installation run as the current user (asInvoker):

<requestedExecutionLevel level="asInvoker" />

However, you can elevate the application installation if you have to. For example, modifying Internet Information Services (IIS) settings in a Web Setup project requires administrative privileges, as does installing assemblies to the global assembly cache. The elevation prompt occurs after the prerequisite installations but before the application installation.

To elevate permissions for an installation, open the project (.vdproj) file. In the project file's MsiBootstrapper section, set the RequiresElevation property to True. This property is not made available through the Visual Studio integrated development environment (IDE). Therefore, you must use the project file. For more information, see RequiresElevation Property.

 

For more detail, you can read into my post: http://social.msdn.microsoft.com/Forums/ar/winformssetup/thread/57d4ee8e-10c5-4a7c-9bdd-82ca3458e83f

posted @ 2011-10-24 14:17  Mike Dos Zhang  阅读(341)  评论(0编辑  收藏  举报