How to enable block programmatically
For drupal 7 the best way will be write hook_enable function in *.install file of your custom module:

&lt;?php

function YOUR_MODULE_NAME_enable() {
          $blocks = array(
            array(
              'status' =&gt; 1,
              'weight' =&gt; 20,
              'region' =&gt; 'sidebar_second',
              'visibility' =&gt; 1,
              'pages' =&gt; "instruments/*",
              'module' =&gt; 'instruments',
              'delta' =&gt; 'instruments_sidebar',
              'theme' =&gt; 'markets',
            ),
            array(
              'status' =&gt; 1,
              'weight' =&gt; 19,
              'region' =&gt; 'sidebar_second',
              'visibility' =&gt; 1,
              'pages' =&gt; "instruments/*\n&lt;front&gt;",
              'module' =&gt; 'instruments',
              'delta' =&gt; 'instruments_search',
              'theme' =&gt; 'markets',
            )
          );

          foreach($blocks as $block){
            db_merge('block')
              -&gt;key(array(
                'module'=&gt;$block['module'],
                'delta'=&gt; $block['delta'],
                'theme'=&gt; $block['theme']
              ))
              -&gt;fields(array(
                'status' =&gt; $block['status'],
                'weight' =&gt; $block['weight'],
                'region' =&gt; $block['region'],
                'visibility' =&gt; $block['visibility'],
                'pages' =&gt; $block['pages'],
              ))
              -&gt;execute();
          }
    }


This is code from my custom module, and it works :)
Here I enable my custom blocks, so I modify 'block' table. For custom blocks you should update 'block_custom' table too.

If you don't know how drupal store settings, just make changes manually and then check DB.

NOTE: db_merge function is very useful - it inserts data if they absent (if you just installed your module) or updates it (if you disabled and then enabled module)