PDA

View Full Version : Not getting Windows error message with SQL Server



notlogan
03-04-2014, 07:57 AM
I'm installing SQL Express as part of my project. Normally the installation goes fine. However SQL Express won't install on Win 7 OS that doesn't have SP2 installed.

When I run my SB 8.1 project the install fails and doesn't flash the error message telling you to install the SP. Is there a way to force this message?

script:
%MY_INSTFOLDER%\SQLEXPR_x86_ENU.exe /ACTION=Install /FEATURES=SQL /INSTANCENAME=DataBinder /SQLSVCACCOUNT="NT AUTHORITY\LOCAL SERVICE" /IACCEPTSQLSERVERLICENSETERMS=True /NPENABLED=1 /TCPENABLED=1 /ADDCURRENTUSERASSQLADMIN /QS

Thanks.

linder
03-05-2014, 03:51 AM
Hello,

You have to check if "SQLEXPR_x86_ENU.exe" returns an error code. For example, if you are using "Run Program..." the %_SB_ERRORCODE% return value can hold the last exit code returned by the executable associated with the work item on its last run (see attached screenshot).

Hope this helps a bit.

Friedrich

notlogan
03-05-2014, 06:07 AM
I'm using Run Command Line. Will that work the same with the return value?

linder
03-05-2014, 06:22 AM
Hello,

No. Only the "Run Program..." script function gives you this extra information (if available).

The "Run Command Line..." script function is just a simple wrapper around the CreateProcess Windows API.

Friedrich

notlogan
03-05-2014, 08:25 AM
So there is really no way I can tell the user why their install failed? There is not a way to show windows generated message boxes?

linder
03-05-2014, 08:39 AM
Of course, you can. Just catch the exit code from the executable. In most cases, Microsoft runtimes return an error code -- you can then display this in a message box.

But that's not your main problem. You should *always* check the system requirements for the specific runtimes (see MSDN) before you launch a runtime. For example, if the runtime requires Windows 7 SP2 then check for SP2 before you launch the redistributable. Display a message that Windows 7 SP2 is required and exit the install. Don't wait for the error ;)

Friedrich

notlogan
03-05-2014, 09:20 AM
DUH......that's obviously the solution.....

Is Get System Info then check service pack # the best way to do it?

I'd have to check if major version number = 6, minor version = 1 and sp>0?

linder
03-05-2014, 09:26 AM
:)

Yes, "Get System Info..." is the way to go. Similar to the attached screenshot... Then, if the OS is Windows 7 and SP is < 1, display a message and terminate the install.

Friedrich

notlogan
03-05-2014, 09:35 AM
OK...I was going to do set three variables: Major OS Minor OS and Service Pack. But WINVER would eliminate having to do major and minor.

Thanks!

notlogan
03-05-2014, 09:59 AM
If %WINVER Equals "$WIN_7$ And %OSSP% Less Than "1" Then
display message
Exit Installation
End
install SQL Server

linder
03-05-2014, 10:31 AM
You are welcome!

Friedrich