Execute SQL command from MSI (Windows Installer Editor)
I am using Window Installer Editor 7.0 and have a .WSI. I need to execute a .sql file utilizing SQLCMD.exe. I need the user’s credentials which I get from a dialog window. I'd like to add an action to when the user clicks "Next >" it would launch my .sql (with the recently add credentials) and depending on the exit code, continue the installation or pop up a dialog.
Answers (2)
You could create a dialog in your MSI to gather the user's data for the SQL login, link the data they enter to properties, then create a custom action to run the SQLCMD command, using said properties.
Be aware that if you want to run the custom action in deferred context you won't be able to access the property values, so you'll either want to make them available throuh the CustomActionData property, or run your CA in immediate context.
As a sidenote, if you have access to an AdminStudio installation, it contains custom tools for inserting SQL statements into an MSI installer.
EDIT: as a matter of fact, just noticed Wise has this too.. using an SQL connection dialog, the WISE_SQL_CONN_STR property and the SQL Server Scripts tool.
Comments:
-
You have to keep the custom action in 'No Sequence' which causes this action to not run unless an event invokes it. - jagadeish 12 years ago
-
true, I overlooked the part where you wanted to link the execution of the script to clicking the "Next" button. Tnx for pointing this out jadageish - pjgeutjens 12 years ago
-
This method would have worked perfectly. Our requirements actually changed as we decided that the program would run with Windows creds.
I'll definitely save this as I'll use this logic elsewhere. Thanks! - mrwillya 12 years ago
We use a program to create exe's to little tasks like this:
http://www.itninja.com/link/winbatch-create-installs-even-recording-mouse-clicks-if-needed
Comments:
-
Not quite what I was looking for. I am an installation developer and we need to handle everything through our MSI.
That's a GREAT tool though! - mrwillya 12 years ago -
It has saved us a lot of hassles in the academic world. Paired with PStools Remote Install we can have one tech image a room of 30 machines by themselves in 1 to 1.5 hours. - SMal.tmcc 12 years ago