Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

How to cehck for admin privileges


5 replies to this topic

tony_123

tony_123
  • Full Members
  • 4 posts

Posted 26 January 2009 - 22:26

Hello,
I am using InstallShield 2009 and basic MSI packages. My package is supposed to open only when the user has admin rights. To do that I added AdminUser condition to the 'Install Condition' of my project. This seemed to work fine for years with Windows 2000, 2003, XP.

Now this is the issue, with 2008 (and I suppose Vista), things have changed. If you are an admin doesn't mean you can run something as admin. You have to specifically say, 'run as admin'. If I don't do that, the package will still try to open. The isn't any message from the package that this is not allowed and then it will fail installing because it can not access Windows\downloaded installation directory.

What I want is the package to return and error that it can not be opened.
The InstallShield has some documentation regarding the AdminUser but it is a little bit confusing to me and it seems that the AdminUser condition should still work.

Any suggestions??

Thanks

*****************************
From InstallShield documentation:

AdminUser Property
The installer sets this property if the user has administrator privileges.

Windows Server 2008 and Windows Vista: The AdminUser property is the same as the Privileged property. Authors should used the Privileged property. The installer sets these properties if the user has administrator privileges, if the application has been assigned by a system administrator, or if both the user and machine policies AlwaysInstallElevated are set to true.
Remarks
The differences between these properties may have been used in some legacy packages. For example, AdminUser may have been used instead of Privileged in conditional statements, because the installer only sets the AdminUser property if the user is an administrator. The installer sets the Privileged property if the user is an administrator, or if policy enables the user to install with elevated privileges.

Windows Server 2008 and Windows Vista: Not supported. The Privileged and AdminUser are the same. Packages that require distinct Privileged and AdminUser properties can restore the difference by setting the MSIUSEREALADMINDETECTION property.

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 27 January 2009 - 15:37

What's the problem you are trying to solve?

If your package can't be downloaded/etracted to the Windows\downloaded installation directory then at this point your setup isn't running yet. SO there's nothing you can do. The solution is to use a difefrent directory where the user has write access.

If your setup requires admin rights already during the user interface sequence you could use a setup.exe lancher. Better: don't require admin rights in UI sequence, but move system modification taks to the Execute sequence.

If you want the AdminUser proeprty to behave like on XP, set the MSIUSEREALADMINDETECTION property. In general this is not recommended, and you should use the Privileged property even on XP.

tony_123

tony_123
  • Full Members
  • 4 posts

Posted 27 January 2009 - 20:20

Sorry if I wasn't clear enough in my first posting.
This is what I would like to achieve:
I want the package to be installed only by an administrator. To do so I have a AdminUser condition in my installation. Now, this has been working fine in 2000, 2003 and XP. In Vista/2008, being an administrator in not enough to have access to the windows directory, system32, etc. In Vista/2008 you also need to run the package as administrator. If my users run my package I want the package to return an error and a message when they wrongly run it without administrator privileges.
Currently on 2008/Vista, if you are admin, the package will try to open but it will return an error because the package which is inside the setup.exe tries to extract the MSI in 'Windows\downloaded installation' directory. What I would like is to avoid this error and prompt a message with instructions on how to run the package correctly (->Right click on the setup.exe and set 'Run as administrator').
Hope this clarify
Thanks

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 28 January 2009 - 22:24

QUOTE
Currently on 2008/Vista, if you are admin, the package will try to open but it will return an error because the package which is inside the setup.exe tries to extract the MSI in 'Windows\downloaded installation' directory. What I would like is to avoid this error and prompt a message with instructions on how to run the package correctly (->Right click on the setup.exe and set 'Run as administrator').

Since the msi part of your install isn't yet running at this point, this would have to be handled by setup.exe. But InstallShield's setup.exe can't do this. So you either need to build your own setup.exe for this purpose, or specify a difefrent default location to extract your msi file to.


tony_123

tony_123
  • Full Members
  • 4 posts

Posted 29 January 2009 - 22:43


It sounds like within the InstallShield I can't auto detect if the user just clicked on the package or it clicked using 'Run as Administrator' option.

Interestingly, I didn't know you can change the default location where an MSI is uncompressed. How can I do that?

Thanks

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 31 January 2009 - 17:49

You can set this in the release wizard (see attached screenshot). The new default is now [LocalAppDataFolder]Downloaded Installations

Attached Images

  • cache_location.png