Archive: install on other user dialog


install on other user dialog
Hello

when i run the install program not with
administrator rights i get a dialog "oher user install.."
i want to avoid this dialog , ands put a MessagfeBox
if not Admin rights end exit install .



Thanks


The XTInfo Plugin has a function to determine if the user is admin or not. You could add this to .OnInit like this:


Function .OnInit
xtInfoPlugin::IsAdministrator
Pop $0
StrCmp $0 "true" continue 0
SetSilent silent
MessageBox MB_OK "You must have Admin rights to run this"
abort

continue:
; *** continue your code here ***
FunctionEnd


There's also a RunAs Plugin that would allow you to ask for the Admin login during the install and then would be able to run as the administrator. It would save the user having to log off and back on, but may not work in your case. (I thought I'd at least mention it.) If you decided to go this way, I'd recommend also using the PassDialog plugin just to keep the password secure.

Hello
Hi
i tried your code .
still get the install program as other user if
running not administrator rights .


OK, let's take a step back:
Do you need to know if the user is Administrator or do you just need the proper permissions to something? (A user can still be admin, but have limited permissions to certain folders, registry keys, etc. depending on how the PC is configured.)

Can you answer these questions:

1) Can you be more specific as to what rights the user is missing? (What exactly fails or what specifically does the user not have rights to do?)

2) I assume that when using my example code that you are NOT getting the messagebox, correct or no?


Hi

1. my app must have admin rights for running
so i dont want to install without admin rights.
2. i got your message after the "install program as other
user" .if you run the install not as admin
the dialog gives you the permission to install
not as admin .


Hi
attach the "install program as other user" dialog


hmm... I guess I misunderstood your question. The message box is coming from Windows itself (not NSIS).

I did some quick searches, but haven't been able to find out exactly what triggers this dialog.

But based on how Windows handles installations in a terminal server environment, I can make some guesses: (I know that you probably aren't using Terminal Services, but my guess is that the same logic applies here. Others feel free to chime in here if I'm mistaken):

1. Windows looks at the name of the program you are running. If it's named "setup.exe" or "install.exe", then it assumes it must be an installation and therefore prompts the user. (You can test this theory by compiling your install under a differnet name such as "test.exe".)

2. If running the install via add/remove programs, then my guess is that it will ALWAYS prompt the message since it would know at this point that you are running an install.

I found this article from MS which explains how the system admin can change the windows policies in such a way to suppress the dialog. (But you'd need admin priveldges to do this.)


Hi
stupid but working

Thanks!!