This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: LaunchAppAndWait problem executing odbcconf.exe through cmd.exe in Windows 7
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
Feb 01, 2012
04:41 AM
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 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?
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?
(1) Reply
Feb 02, 2012
09:21 AM
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.