diff --git a/modules/metarefresh/bin/metarefresh.php b/modules/metarefresh/bin/metarefresh.php
index eff2c731342c925f7eada2f452f3ef15f659db71..c8a918122f8f7979ca78dc00c57a45ca555bc644 100755
--- a/modules/metarefresh/bin/metarefresh.php
+++ b/modules/metarefresh/bin/metarefresh.php
@@ -13,6 +13,13 @@ $baseDir = dirname(dirname(dirname(dirname(__FILE__))));
 /* Add library autoloader. */
 require_once($baseDir . '/lib/_autoload.php');
 
+if(!SimpleSAML_Module::isModuleEnabled('metarefresh')) {
+	echo("You need to enable the metarefresh module before this script can be used.\n");
+	echo("You can enable it by running the following command:\n");
+	echo('  echo >"' . $baseDir . '/modules/metarefresh/enable' . "\"\n");
+	exit(1);
+}
+
 /* Initialize the configuration. */
 SimpleSAML_Configuration::setConfigDir($baseDir . '/config');