Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Moodle CLINew to Visual Studio Code? Get it now.
Moodle CLI

Moodle CLI

Helmes V. Santos

|
2 installs
| (1) | Free
Run Moodle CLI scripts directly from VSCode with parameter support
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Moodle CLI

Run Moodle CLI scripts directly from VSCode — with parameter wizards, grouped commands, and full Command Palette integration.

GitHub

Features

  • Command Palette — search and run any Moodle CLI script via Ctrl+Shift+P → Moodle CLI:
  • Sidebar panel — browse all CLI commands grouped by category in the activity bar
  • Parameter wizard — guided step-by-step input for each parameter, with descriptions and examples
  • Run with or without parameters — execute directly or configure arguments before running
  • Integrated terminal — commands run in a dedicated terminal, reusable across executions

Getting Started

  1. Open your Moodle project folder in VSCode
  2. Set the Moodle root path in settings: moodleCli.moodleRoot
  3. Run any command via Ctrl+Shift+P → type Moodle CLI

Commands

All commands are available in the Command Palette under the Moodle CLI category:

Installation & Upgrade

Command Script
Install admin/cli/install.php
Upgrade admin/cli/upgrade.php
Install Database admin/cli/install_database.php

Maintenance & Cache

Command Script
Purge Caches admin/cli/purge_caches.php
Maintenance Mode admin/cli/maintenance.php
Fix Course Sequence admin/cli/fix_course_sequence.php
Rebuild Course Cache admin/cli/rebuild_course_cache.php
Fix Orphaned Question Categories admin/cli/fix_orphaned_question_categories.php

Cron & Tasks

Command Script
Run Cron admin/cli/cron.php
Run Scheduled Task admin/tool/task/cli/schedule_task.php
Run Ad-hoc Tasks admin/cli/adhoc_task.php
List Scheduled Tasks admin/tool/task/cli/schedule_task.php

Users

Command Script
Reset Admin Password admin/cli/reset_password.php
Suspend/Delete User admin/cli/suspend_user.php
Bulk User Delete admin/cli/delete_users.php

Backup & Restore

Command Script
Backup Course admin/cli/backup.php
Automated Backup admin/cli/automated_backups.php

Database

Command Script
Check Database Schema admin/cli/check_database_schema.php
Fix Database Encoding admin/cli/mysql_collation.php
Generate Install SQL admin/cli/generate_install_sql.php

Performance & Profiling

Command Script
Clear Session Cache admin/cli/session_gc.php
Check Config admin/cli/cfg.php

Plugins

Command Script
Uninstall Plugin admin/cli/uninstall_plugins.php

Enrolment

Command Script
Enrol Users enrol/manual/cli/enrol_users.php
Sync Enrolments enrol/ldap/cli/sync.php

Analytics & Reports

Command Script
Evaluate Analytics Model admin/tool/analytics/cli/evaluate_model.php

Settings

Setting Default Description
moodleCli.moodleRoot (workspace root) Path to the Moodle root directory
moodleCli.phpExecutable php Path to the PHP executable
moodleCli.terminalName Moodle CLI Name of the integrated terminal
moodleCli.reuseTerminal true Reuse the same terminal for all commands

Usage

Via Command Palette

  1. Press Ctrl+Shift+P
  2. Type Moodle CLI to filter commands
  3. Select a command — if it has parameters, choose Run or Run with Parameters

Via Sidebar

  1. Click the Moodle CLI icon in the activity bar
  2. Expand the Admin CLI group and browse by category
  3. Click a command to run it, or use the inline buttons:
    • ▶ Run directly
    • ⚙ Run with parameters

Parameter Wizard

When running with parameters:

  1. A list of available parameters is shown — select which ones to include
  2. For each selected parameter, enter the value (with description and example shown)
  3. The command is assembled and sent to the terminal

Requirements

  • PHP must be installed and accessible (configure path via moodleCli.phpExecutable if needed)
  • A Moodle installation must be present at the configured root path
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft