cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
abeytr
Level 2

LaunchAppAndWait problem executing odbcconf.exe through cmd.exe in Windows 7

Hi

I use the LaunchAppAndWait(..) method and try to invoke cmd.exe and then execute the odbcconf.exe command. Everything works fine with Windows XP, but when I try the same thing with Windows 7, it is not creating the ODBC DSN entry. I am sure that it has something to do with the administrator rights.
I will post my code here:

if (bResult) then    
bResult = FALSE;
regCmdLine = "/C " + "odbcconf.exe CONFIGSYSDSN \"SQL Server\" \"DSN=dss_db|Description=My Database App database|Server=.\\SQLEXPRESS|Trusted_Connection=Yes|Database=MyDBName\" ";
if (LaunchAppAndWait("cmd.exe", regCmdLine , LAAW_OPTION_WAIT | LAAW_OPTION_HIDDEN) = 0) then
bResult = TRUE;
else
MessageBox("Failed to set ODBC Settings. Arguments = " + regCmdLine, SEVERE);
endif;
endif;


If I execute the command odbcconf.exe CONFIGSYSDSN "SQL Server" "DSN=dss_db|Description=My Database App database|Server=.\\SQLEXPRESS|Trusted_Connection=Yes|Database=MyDBName" directly from the cmd.exe which I started with 'Run as Administrator' option, it works fine. I also tried running the setup.exe created with InstallShield with 'Run as Administrator' option - it doesnt work.

Can somebody help me to achieve the same thing with Installshield?
Labels (1)
0 Kudos

(1) Reply
DebbieL
Level 17

You may want to see if switching from LaunchAppAndWait to LaunchApplication, and passing LAAW_OPTION_USE_SHELLEXECUTE to nOptions, solves the issue. For systems that are running Windows Vista or later, you can set LAAW_SHELLEXECUTEVERB to runas before calling LaunchApplication in your script. The LaunchApplication help topic in the InstallShield help library has more information.
0 Kudos