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

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
- Open your Moodle project folder in VSCode
- Set the Moodle root path in settings:
moodleCli.moodleRoot
- 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 |
| 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
- Press
Ctrl+Shift+P
- Type
Moodle CLI to filter commands
- Select a command — if it has parameters, choose Run or Run with Parameters
- Click the Moodle CLI icon in the activity bar
- Expand the Admin CLI group and browse by category
- Click a command to run it, or use the inline buttons:
▶ Run directly
⚙ Run with parameters
Parameter Wizard
When running with parameters:
- A list of available parameters is shown — select which ones to include
- For each selected parameter, enter the value (with description and example shown)
- 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
| |