Frank
Frank

Reputation: 3143

How do I force a Visual Studio setup project generated msi installer to only run in administrative mode?

I have a Visual Studio setup project that generates an msi installer. The installer works fine if I run it as an administrator. If it is not run as an administrator my updates to HKEY_CURRENT_USER\Software\Microsoft\Office fail.

I have looked at Launch Conditions, Custom Actions and Prerequisites from the project properties but I could not figure out how to do this.

Is it possible to to create an install that will warn users and fail if it is not run with administrative privileges?

Thanks

Upvotes: 2

Views: 5951

Answers (1)

Alexey Ivanov
Alexey Ivanov

Reputation: 11878

Set ALLUSERS to 2.

You can use Privileged property in a conditional Custom Action to show an Error to the user, or simply use it in a LaunchCondition. The Privileged property is set if user has Administrative rights or can perform elevated installation.

See also AdminUser property.

Upvotes: 4

Related Questions