diff --git a/optimizely.admin.inc b/optimizely.admin.inc
index 18643da..392b627 100644
--- a/optimizely.admin.inc
+++ b/optimizely.admin.inc
@@ -328,24 +328,13 @@ function optimizely_account_settings_form_validate($form, &$form_state) {
  * record with the project ID which is also the account ID.
  */
 function optimizely_account_settings_form_submit($form, &$form_state) {
-
-  // Write the variable table
-  variable_set('optimizely_id', $form_state['values']['optimizely_id']);
-
-  // Update the default project / experiement entry with the account ID value
-  db_update('optimizely')
-    ->fields(array(
-        'project_code' => $form_state['values']['optimizely_id'],
-      ))
-    ->condition('oid', '1')
-    ->execute();
+  _optimizely_update_oid($form_state['values']['optimizely_id']);
 
   // Inform the administrator that the default project / experiement entry is ready to be enabled.
   drupal_set_message(t('The default project entry is now ready to be enabled. This will apply the default Optimizely project tests site wide.'), 'status');
 
-  // Redirect back
+  // Redirect back.
   $form_state['redirect'] = 'admin/config/system/optimizely';
-
 }
 
 /**
@@ -1001,4 +990,23 @@ function _optimizely_valid_paths($project_paths) {
   }
 
   return TRUE;
-}
\ No newline at end of file
+}
+
+/**
+ * Set the Optimizely oid.
+ *
+ * @parm $oid
+ *   An oid provided by Optimizely.
+ */
+function _optimizely_update_oid($oid) {
+  // Write the variable table.
+  variable_set('optimizely_id', $oid);
+
+  // Update the default project / experiement entry with the account ID value.
+  $result = db_update('optimizely')
+    ->fields(array(
+        'project_code' => $oid,
+      ))
+    ->condition('oid', '1')
+    ->execute();
+}
diff --git a/optimizely.drush.inc b/optimizely.drush.inc
new file mode 100644
index 0000000..dbcb5c1
--- /dev/null
+++ b/optimizely.drush.inc
@@ -0,0 +1,60 @@
+<?php
+
+/**
+ * @file
+ * Drush integration of optimizely.
+ *
+ * The command takes the form of
+ * drush optimizely-set-id ###
+ */
+
+/**
+ * Implements hook_drush_help().
+ */
+function optimizely_drush_help($section) {
+  switch ($section) {
+    case 'drush:optimizely-set-id':
+      return dt('Set the optimizely account ID.');
+  }
+}
+
+/**
+ * Implements hook_drush_command().
+ */
+function optimizely_drush_command() {
+  $items = array();
+
+  $items['optimizely-set-id'] = array(
+    'callback' => 'optimizely_set_id',
+    'drupal dependencies' => array('optimizely'),
+    'description' => 'Set the optimizely account ID.',
+    'arguments' => array(
+      'oid' => 'The ID to set.',
+    ),
+    'bootstrap' => DRUPAL_BOOTSTRAP_VARIABLES,
+    'aliases' => array('op-id'),
+  );
+
+  return $items;
+}
+
+/**
+ * Callback function for optimizely-set-id command.
+ *
+ * @parm $oid
+ *   An oid provided by Optimizely and entered via drush. Must be an integer.
+ */
+function optimizely_set_id($oid = NULL) {
+  module_load_include('inc', 'optimizely', 'optimizely.admin');
+
+  if (empty($oid)) {
+    return drush_set_error(dt('The ID of the Optimizely account is required.'));
+  }
+  if (!preg_match('/^\d+$/', $oid)) {
+    return drush_set_error(dt('Your Optimizely ID should be numeric.'));
+  }
+
+  _optimizely_update_oid($oid);
+
+  drush_log(dt('The Optimizely ID was set to @oid. The default project entry is now ready to be enabled. This will apply the default Optimizely project tests site wide.', array('@oid' => $oid)), 'ok');
+}
