cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
bobmcm461
Level 6

How do I get the SQL Server Name

I'm using an Installscript MSI installation. I need to retrieve the SQL Server name. It seems to be stored in the MSI property IS_SQLSERVER_SERVER, but when I perform the following MSIGetProperty command the szSQLServer variable is empty.

MsiGetProperty(ISMSI_HANDLE, "IS_SQLSERVER_SERVER", szSQLServer, nvBuffer);
MsiGetProperty(ISMSI_HANDLE, "[IS_SQLSERVER_SERVER]", szSQLServer, nvBuffer);

I have used the property at other parts of the installation, but I need to get access to it via script.

Thanks,
Robert McMahan
Labels (1)
0 Kudos
(3) Replies
ch_eng
Level 7

When are you calling the MsiGetProperty function? (OnFirstUIBefore/OnFirstUIAfter/etc) As far as I know, there are some places where calling it doesn't work: ex: OnFirstUIAfter, OnResumeUIAfter, OnAbort.

Also, is your nvBuffer set before calling MsiGetProperty? If that is the only variable you are using for getting property values, it has to be reset between each call.

Ex:
nvBuffer = 256;
MsiGetProperty(ISMSI_HANDLE, "IS_SQLSERVER_SERVER", szSQLServer, nvBuffer);
nvBuffer = 256;
MsiGetProperty(ISMSI_HANDLE, "[IS_SQLSERVER_SERVER]", szSQLServer, nvBuffer);
0 Kudos
GarrettDyer
Level 5

In the Dialogs view of the IS IDE, click on the combobox control that the server\instance appears in during the UI sequence. Determine the Property name assigned to that combobox...it's possible that it's not IS_SQLSERVER_SERVER.

When you have that, make sure that you're adding that Property name to CustomActionData so that your Deferred Action will be able to read it.
0 Kudos
bobmcm461
Level 6

I'm currently calling it in OnFirstUIBefore, but I would prefer to call it in MyFeature_Installed. The problem that I had in callling it in OnFirstUIBefore was that I didn't init nvBuffer. Unfortunatly, performing the same code in MyFeature_Installed does not work. I get a ERROR_SUCCESS value in my return so I believe that the MSIGetProperty function believes that it has worked properly, but the value for server is blank. I guess that the property has been cleared at some point. It looks as though I'm going to have to modify the OnSQLLogin function to store the information in a global variable for use in the MyFeature_Installed. Not the best solution, but I need the information after the files have been copied, and I don't want to prompt the user for the it twice.

Thanks for the help,
Robert McMahan
0 Kudos