Executing runas.exe without user interaction - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

chemoinformatics
Posts: 11
Joined: Wed Mar 09, 2011 4:03 am

Executing runas.exe without user interaction

Hi,

I am using Advanced Installer 6.9.1 enterprise version.

Here are my queries and issues.

Q1. I want to execute runas.exe file with following parameters.

Code: Select all

runas.exe /user:%COMPUTERNAME%\postgres "%PGHOME%\bin\initdb.exe -D %PGDATA%"
Once you run the above command, program will ask for password which has to be typed automatically without user input.

Note : There is no command line parameter in runas.exe to give password.

Thanks

RJ, Chemoinformatics
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Executing runas.exe without user interaction

Hello,

I am not aware of any command line switch that will pass the user password to "runas.exe".

Here is the complete Technet article for the runas tool.

You can launch runas from your installer with a "Launch File or Open URL" predefined custom action. Here is our user guide reference to get you started.

Best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
chemoinformatics
Posts: 11
Joined: Wed Mar 09, 2011 4:03 am

Re: Executing runas.exe without user interaction

Hi,

I found the solution for that, anyway i will get more specific to the problem.

Code: Select all

runas.exe /user:[ComputerName]\postgres "notepad.exe" | "[APPDIR]\data\bin\sanur.exe" postgres
When i run the above command from command line it works perfectly. But when i run from "Add Predefined Custom Action"=>Launch File or Open Url, it does not run as it should. Why?

sanur.exe is program that will provide the password for runas.exe without user intervention. For more info : http://www.commandline.co.uk/sanur_unsu ... index.html

Thanks
RJ
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Executing runas.exe without user interaction

Hello,

Since you are using installed resources in your command line operation, you must place your custom action after the Install standard action. After that point the files are on the hard drive ready to be accessed.
Also, you should remove the backslash after the "[APPDIR]" formatted reference because when it will be resolved it will already contain one at the end.

This program may require admin privileges to run so it might be a good idea to set the custom action with "Deferred with no impersonation".

Best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
chemoinformatics
Posts: 11
Joined: Wed Mar 09, 2011 4:03 am

Re: Executing runas.exe without user interaction

Hi

You solution doesn't seem to fix the problem.

1. Created empty enterprise installer project which just installs one text file.
2. Created a custom action

Code: Select all

runas /user:RAJA\postgres "notepad.exe" | "c:\sanur.exe" postgres
all hard coded. InstallExecuteSequence=>Install for <AI_CUSTACTS>viewer.exe with execution options "Deferred with no impersonation".
3. Build and execute, still it does not launch the notepad, that means it did not execute successfully.

Note : RAJA\postgres user exists in the system, sanur.exe is copied and path is hard coded.

Thanks

RJ
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Executing runas.exe without user interaction

Hello,

Can you please send us the .AIP (project) and a verbose log of the installation to support at advancedinstaller dot com so we can investigate them?

Best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Executing runas.exe without user interaction

Hello,

I have looked into your .AIP and log file. Can you please set your custom action with "Deferred with no impersonation" and see the outcome?

Best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
chemoinformatics
Posts: 11
Joined: Wed Mar 09, 2011 4:03 am

Re: Executing runas.exe without user interaction

I have attached the log with Deferred and Deferred with no impersonation.
Attachments
test_1.log
(218.15 KiB) Downloaded 640 times
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Executing runas.exe without user interaction

Hi,

The log indicates the successful execution of the custom action, I am not sure what happens.

Maybe your commands need to be executed under a certain user account? When you set the custom action as deferred it will make it run under the SYSTEM user account, with full admin rights.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
chemoinformatics
Posts: 11
Joined: Wed Mar 09, 2011 4:03 am

Re: Executing runas.exe without user interaction

If log indicates the successful execution, that does not mean it worked as expected. Moreover i won't be posting issue in first place.

1. Just create empty enterprise aip project in 6.9.1
2. Create a user called "postgres" with password "postgres"
3. Create custom action for

Code: Select all

runas /user:[ComputerName]\postgres "notepad.exe" | "c:\sanur.exe" postgres
4. Build and run the setup
5. If the setup opens the notepad application. please let me know.

Thanks
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Executing runas.exe without user interaction

Hi,

Can you please provide us with the download link of the runas tool you are using?

Best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
chemoinformatics
Posts: 11
Joined: Wed Mar 09, 2011 4:03 am

Re: Executing runas.exe without user interaction

Hi,

All the files required is inside the zip file. And also there is batch file which works by popping out the notepad application. But same command does not work using custom action.

http://www.chemoinformatics.com/downloads/cmdtools.zip

Thanks
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Executing runas.exe without user interaction

Hi,

After doing several tests the problem was narrowed down to the sanur program. The correct usage of sanur in this context is described in the following article.
Thus the command line in the custom action should be:
cmd.exe /c runas /user:[ComputerName]\postgres "notepad.exe" | "c:\sanur.exe" postgres
Also, since the custom action already performs an impersonation, you should leave it as "Deferred". Because it launches another program it should also be set with "Asynchronous execution, do not wait for return"

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”