Answers.Body: <p>Thanks to <a href="https://civicrm.stackexchange.com/questions/16423/passing-json-objects-to-drush-cvapi">passing JSON objects to drush cvapi</a> I found a solution:</p>
  
  <pre><code>echo '{"enable_components" :["CiviContribute","CiviMember","CiviMail","CiviReport","CiviEvent"] }' | drush cvapi Setting.create --in=json
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-19T22:35:32.657Z
Answers.LastActivityDate: 2018-01-19T22:35:32.657Z
Answers.UserDisplayName: Kainuk - CiviCooP
Answers.Body: <p>For those that use <code>cv</code> is also possible to use:</p>
  
  <pre><code>echo '{"enable_components" :["CiviContribute","CiviMember","CiviMail","CiviReport","CiviEvent"] }' | cv api Setting.create --in=json
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-21T23:17:32.857Z
Answers.Text: For API4, the syntax is: `echo '{"values":{"enable_components":["CiviContribute","CiviMember","CiviReport"]}}' | cv api4 Setting.set --in=json` or `cv api4 Setting.set '{"values":{"enable_components":["CiviContribute","CiviMember","CiviReport","CiviPledge"]}}'`.
Answers.UserDisplayName: Martin_W
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-01T19:19:31.527Z
Answers.LastActivityDate: 2018-04-01T19:19:31.527Z
Answers.UserDisplayName: Kainuk - CiviCooP
Body: <p><code>drush</code> and <code>cv</code> have both have commands to install extensions. But know I want to create a script that sets the CiviCRM components. Is it possible to do this?</p>
  
Tags: <installation><drush><cli><cv>
Title: Is it possible to set the list of CiviCRM components from the command line using drush
ThreadText: # Is it possible to set the list of CiviCRM components from the command line using drush
  
  (Asked by: username_0 on 2018-01-19)
  
  `drush` and `cv` have both have commands to install extensions. But know I want to create a script that sets the CiviCRM components. Is it possible to do this?
  
  **Tags:** installation, drush, cli, cv
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2018-01-19. Score: 2 | Accepted answer
  
  Thanks to [passing JSON objects to drush cvapi](https://civicrm.stackexchange.com/questions/16423/passing-json-objects-to-drush-cvapi) I found a solution:
  
  ```
  echo '{"enable_components" :["CiviContribute","CiviMember","CiviMail","CiviReport","CiviEvent"] }' | drush cvapi Setting.create --in=json
  
  ```
  
  
  ---
  
  ### Answer by username_0 on 2018-04-01. Score: 2
  
  For those that use `cv` is also possible to use:
  
  ```
  echo '{"enable_components" :["CiviContribute","CiviMember","CiviMail","CiviReport","CiviEvent"] }' | cv api Setting.create --in=json
  
  ```
  
  > **Comments:**
  > **username_1**: For API4, the syntax is: `echo '{"values":{"enable_components":["CiviContribute","CiviMember","CiviReport"]}}' | cv api4 Setting.set --in=json` or `cv api4 Setting.set '{"values":{"enable_components":["CiviContribute","CiviMember","CiviReport","CiviPledge"]}}'`.  
  
  ---
  
  