Requiring a Server-Side Installation for an InstallScript Project

InstallShield 2019

Project • This information applies to InstallScript projects.

One way to enforce a server-side installation in an InstallScript project is to set up your installation project so that it searches for a specific registry key and value and only installs the installation project if the value is found. See the sample code below for an example of how you can do this in your InstallScript project.

function OnBegin()

    string sKey, sValue, sData;

    string sMsg;

    number nType, nSize, nResult;

begin

    

    RegDBSetDefaultRoot( HKEY_LOCAL_MACHINE );

    sKey = "Software\\Microsoft\\Microsoft SQL Server";

    sValue = "InstalledInstances";

    nResult = RegDBGetKeyValueEx( sKey, sValue, nType, sData, nSize );

    

    if( nResult < 0 ) then

 

        //SQL Server registry key is missing

        sMsg = "Microsoft SQL Server was not found on this machine.\n" +

               "This installation was designed to run only on the server machine.";

        MessageBox( sMsg, SEVERE );

        abort;

 

    endif;

    

end;

See Also