cancel
Showing results for 
Search instead for 
Did you mean: 

Environment variable

4,212

We had an instance of a Windows 2003 server install of 12.0.1.3352 where the SQLANY12 environment variable was not created, as described in another question in this forum.

When the InstallShield setup from our application started the install process was aborted as the SQLANY12 environment variable was not found and there was no indication that any issue was found in the server or user settings during the 12.0.1 install.

Is there a way to have a warning message displayed during the install that SQLANY12 variable has not been successfully created?

Accepted Solutions (1)

Accepted Solutions (1)

jeff_albion
Advisor
Advisor

How are you creating this install deployment? Are you just using the regular SQL anywhere product install or did you create your own deployment using the Deployment Wizard?

By default, both the full SQL Anywhere setup and the Deployment Wizard installs create a "SQLANY12" environment variable using the regular Windows Installer features, which should create a system-level environment variable on installation and remove it upon uninstallation.

To see this: Open the SQL Anywhere MSI in "Orca" -> "Tables" -> "Environment" -> "*=-SQLANY12"

( To see the table of what the "*=-" code means before the environment variable, see: http://msdn.microsoft.com/en-us/library/windows/desktop/aa368369%28v=vs.85%29.aspx )

Have you tried monitoring the operating system while you are installing SQL Anywhere and checking with a tool such as "Process Monitor" to see if you are hitting any OS-level permissions issues with these installations when creating the environment variable? Have you tried to enable logging of the SQL Anywhere installation by using:

setup.exe "/v: /l*v! logfile"

to see if there are any errors logged when you install?


Is there a way to have a warning message displayed during the install that SQLANY12 variable has not been successfully created?

To answer your question, if you are creating your own MSI, you could potentially modify the MSI actions and launch your own install VBS script at post-install to check whether the variable that you're interested in exists:

(Warning: Untested code! Hopefully this should get you started...)

' ====================================
' == post-install-env-check.vbs
' ====================================

Dim oShell
Set oShell = CreateObject("WScript.Shell")
If Not oShell Is Nothing Then
    Set WshSysEnv = oShell.Environment("SYSTEM")
    If Not IsNull(WshSysEnv("SQLANY12")) Then
        If WshSysEnv("SQLANY12") = "" Then
        MessageBox("WARNING! Variable %SQLANY12% may not be correctly set. " &_
                   "Check permission on HKEY_LOCAL_MACHINE\\\\SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment ?")
        End If
    Else
        MessageBox("WARNING! Variable %SQLANY12% may not be correctly set. " &_
                   "Check permission on HKEY_LOCAL_MACHINE\\\\SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment ?")
    End If
    Set WshSysEnv = Nothing
    Set oShell = Nothing
End If

In Orca with the MSI loaded, you would then need to go to the "Binary" table. Add an entry:

Name         Data
EnvCheck     [Binary Data]   (Browse to 'post-install-env-check.vbs')

Go to the "Custom Action" table. Add an entry:

Name         Type            Source
DoEnvCheck   6               EnvCheck

Go to the "InstallExecuteSequence" table. Add an entry:

Action  Condition        Sequence
DoEnvCheck  NOT Installed    6700

Save, and run the MSI.

0 Kudos

The first install was done with the regular SQL Anywhere install (12.0.1.3352). This was the first time we had this issue during a install so the answer for your question is no, we didn't have any monitoring tool in place while installing SQL Anywhere and it was done with full admin rights.

I was wondering if a message could be displayed from the regular SQL Anywhere Install setup to warn the user when it was not possible to create the environment variable for any specific reason. Thanks anyway for your suggestions!

jeff_albion
Advisor
Advisor
0 Kudos

As I mentioned, the environment variables to be set are handled by the Microsoft Windows Installer process - the MSI information should be correct to set this information for both the full SQL Anywhere install and the Deployment Wizard installs. (i.e. you can see the values in Orca).

If the Windows Installer can't set/generate environment variables, I would expect that the Windows Installer would throw an error (e.g. Event ID 1032 - "Windows Installer Environment Variables Refresh" ) as it is the Windows Installer's responsibility to create (and check for) the variables correctly. You should be able to add additional logging in the Windows Installer process to catch this issue, otherwise using Process Monitor should provide you with enough detail about the exact permissions issue.

It seemed to me that EventID 1032 would only be triggered when an existing environment variable couldn'be updated which is not the case in a fresh install. However, I agree with yout that MSI should take care about this type of events during the install. Thanks Jeff!

Answers (0)