diff --git a/apps/files/command/scan.php b/apps/files/command/scan.php
index 25ab70af3629a7d50940c589f1b6cd41c52dd62b..f334f29a939e3002600212d079b22b45c6087c5f 100644
--- a/apps/files/command/scan.php
+++ b/apps/files/command/scan.php
@@ -58,6 +58,7 @@ class Scan extends Command {
 
 	protected function execute(InputInterface $input, OutputInterface $output) {
 		if ($input->getOption('all')) {
+			\OC_App::loadApps('authentication');
 			$users = $this->userManager->search('');
 		} else {
 			$users = $input->getArgument('user_id');