How I can create installer which can run ONLY with administrative rights? (Visual Studio 2010)

StackOverflow https://stackoverflow.com/questions/9044564

سؤال

I have project written in C#. I create install project for this project, and I really want that this setup can run only if user has administrative rights. How I can do this?

I tried to add "Launch Condition" with condition = AdminUser, then I build my setup project, but installer can be run from user without admin rights.

هل كانت مفيدة؟

المحلول

AdminUser and Privileged properties can be used to detect Administrator privileges on older Windows versions.

However, on Vista and Windows 7 any user can become an Administrator through elevation (UAC). So you cannot detect if the current user is an Administrator or not.

The most you can do is write a custom action which detects what permissions are assigned to the current user and try to determine if he is an Administrator based on that. But this is rarely worth the effort.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top