Archive: User == Administrator


User == Administrator
Is there a way to check if a user is administrator. I have a problem with SetShellVarContext.

If a normal user (not administrator) shooses to install app for all users, it works (SetShellVarContext == All). But the uninstaller doesn't delete the files. Very strange.

If I could check if it is an administrator, problem would be solved.


If you used SetShellVarContext all in install sections, you have to use it in uninstall section as well.
As for user checking, refer to wiki.


I have been having the same trobule installing for all users. The install works fine but when I uninstall I am left with the desktop Icon, every thing else uninstalls ok. What I am doing is using the Userinfo example to get an Admin user. Once it is Admin user I set the setShell VarContext to equal all. This installs OK. Have you any Idea why the Icon is being left behind when Uninstall takes place. This only happens when I use setShellVarContext. Any examples would be useful if you know what is causing this.


To see if the user has administrative privileges:
You could use the UserInfo plugin as described here, or the system plugin as described here.

Another option would be to look for certain user privileges that relate to the admin account as described here or even enumerate all the available users as described here.

Finally you could just check the groups that the current user belongs to as described here

As for the desktop icon which is left behind, are you running the uninstaller using an admin context or a simple user? If you are uninstalling as a user try setting the write permissions for that file when you install your application so that everyone can delete it.
CF