umaunni
Posts: 15
Joined: Wed Jul 11, 2012 3:31 pm

Run a .msi with admin priveleges

I have a .msi created using advanced installer. Everytime, I need to run it, I have to right click and select run as administrator. How can I impersonate the same procedure using cmd? I tried running the cmd in admin mode and then executed the .msi. I am providing the values to properties in cmd. When I run it in full UI mode with properties already mentioned, it runs fine.I just have to click next, next ,next..But when I run the same in basic silent(QB) mode it fails to install. The error that I get in silent mode is the same as that I get when I run the .msi manually in normal mode,i.e. when I dont right click and select run as admin. So, I guess the application in silent mode is unable to get admin privileges. I tried runas /noprofile /user: mymachine\administrator but everytime I end us opening the help menu. So, that is not working. I tried creating a batch file and then ran it in admin mode. That also doesn't work. Is it even possible in Windows 7 to run a .msi with admin privileges through cmd. Even code in any language that could help with this would be fine.
Dan
Posts: 4529
Joined: Wed Apr 24, 2013 3:51 pm

Re: Run a .msi with admin priveleges

Hello,

I'm not sure why you encountered this behavior.
When you run your installation package through a non elevated command line, since there is no User Interface, the installation will fail if it require administrator rights.
If you run from an elevated command line, then the installation process should success.

As a side note, when the command line is elevated, by default the view is in C:\Windows\system32>. When the command line is not elevated, then the view is set to C:\Users\LogonUser>.

If the behavior still persist, please send us the .AIP (project file) and a verbose log of the installation process when the it fails and another log when the instalation process success to support at advancedinstaller dot com so we can investigate them.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
umaunni
Posts: 15
Joined: Wed Jul 11, 2012 3:31 pm

Re: Run a .msi with admin priveleges

I am running from elevate cmd. In full UI mode it is a success. But when I run the same in silent mode it fails. And yes it is, C:\Windows\system32> .
Secondly, the properties that I mention in silent mode are also correct, since if I run the installer in full UI mode with properties passed in the cmd, I see all the correct options selected and correct values in text boxes which is obviously a success. But, with silent mode, the same fails.

I am not sure if I am allowed to give you the aip file. I'll check with my senior about that.
Meanwhile, if it's possible can you suggest me how can I exactly check where the problem is.?
Dan
Posts: 4529
Joined: Wed Apr 24, 2013 3:51 pm

Re: Run a .msi with admin priveleges

Hello,

In order to have a better view about this, can you please send us a the .AIP (project file) and a verbose log of the installation process when it fails and when the installation process success to support at advancedinstaller dot com so we can investigate them?
If it contains confidential information you can send us a small test project which reproduce this behavior.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
umaunni
Posts: 15
Joined: Wed Jul 11, 2012 3:31 pm

Re: Run a .msi with admin priveleges

One more thing I noticed. I tried to run it on a server where we have full administrative privileges. Though it failed again, I checked the logs that we create while installing and found that the installer was unable to communicate with the database. The login was failing. I don't know why because the username and password are absloutely correct
Dan
Posts: 4529
Joined: Wed Apr 24, 2013 3:51 pm

Re: Run a .msi with admin priveleges

Hello,

This may also happens if you have custom actions that are added without sequence and are executed as published events on a button push. Since there is no trigger (the button push event) they are not executed.

However, I would be able to suggest you a better resolution if you send the .AIP (project file) and a verbose log of the installation process when it fails to support at advancedinstaller dot com. If it contains confidential information you can send us a small test project which reproduce this behavior.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
umaunni
Posts: 15
Joined: Wed Jul 11, 2012 3:31 pm

Re: Run a .msi with admin priveleges

I went through the verbose log and found this :
MSI (s) (20:F0) [10:48:51:960]: Note: 1: 1708
MSI (s) (20:F0) [10:48:51:960]: Product: SomeName -- Installation failed.

MSI (s) (20:F0) [10:48:51:961]: Windows Installer installed the product. Product Name: SomeName Database 13.1. Product Version: 13.1. Product Language: 1033. Manufacturer: CompanyName. Installation success or error status: 1603.

MSI (s) (20:F0) [10:48:52:908]: Deferring clean up of packages/files, if any exist
MSI (s) (20:F0) [10:48:52:909]: MainEngineThread is returning 1603
MSI (s) (20:98) [10:48:52:910]: RESTART MANAGER: Session closed.
=== Logging stopped: 3/10/2014 10:48:51 ===
MSI (s) (20:98) [10:48:52:912]: User policy value 'DisableRollback' is 0
MSI (s) (20:98) [10:48:52:912]: Machine policy value 'DisableRollback' is 0
MSI (s) (20:98) [10:48:52:912]: Incrementing counter to disable shutdown. Counter after increment: 0
MSI (s) (20:98) [10:48:52:912]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2
MSI (s) (20:98) [10:48:52:913]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2
MSI (s) (20:98) [10:48:52:913]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied. Counter after decrement: -1
MSI (s) (20:98) [10:48:52:914]: Restoring environment variables
MSI (s) (20:98) [10:48:52:914]: Destroying RemoteAPI object.
MSI (s) (20:5C) [10:48:52:914]: Custom Action Manager thread ending.
MSI (c) (10:D0) [10:48:52:916]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied. Counter after decrement: -1
MSI (c) (10:D0) [10:48:52:916]: MainEngineThread is returning 1603
=== Verbose logging stopped: 3/10/2014 10:48:52 ===

I also checked for return value 3 and found that one of the vbscripts is not running. When , I went through that line in the VB Script where the error was mentioned in the log, I coudn't find any error. Plus the same script is executing perfectly without any error in full UI mode. Any idea, what else could be the problem.
That part of VB Script in which it is showing the error looks something like this :

objConn.Open "Driver={" & Session.Property("DBDRIVER_PROP") & "};" & _
"Server=" & Session.Property("SERVER_PROP") & ";" & _
"user id=" & Session.Property("USERNAME_PROP") & ";" & _
"password=" & Session.Property("PASSWORD_PROP") & ";" & _
"Initial Catalog=" & Session.Property("BCOREDBNAME")& ";"


Before and after this there are only comments. Verbose log points to an error at the first line.
In addition to this I could find the properties SERVER_PROP, USERNAME_PROP, PASSWROD_PROP, BCOREDBNAME assigned in the verbose log but I could not find DBDRIVER. I tried to pass it as an argument in command line also but that failed too.
umaunni
Posts: 15
Joined: Wed Jul 11, 2012 3:31 pm

Re: Run a .msi with admin priveleges

And I also found this line: Running product '{some key}' with elevated privileges: Product is assigned.

So, I guess its running in admin mode and problem is something else.

Return to “Common Problems”