diff --git a/contrib/bin/fusiondirectory-setup b/contrib/bin/fusiondirectory-setup
index 2e305724cc986dab624cb02841ecdffa7bf4a3d7..38d6123a9a4807d70d103def9f479e4f9269a5fb 100644
--- a/contrib/bin/fusiondirectory-setup
+++ b/contrib/bin/fusiondirectory-setup
@@ -960,8 +960,6 @@ sub branch_exists {
 
 # function that check LDAP configuration
 sub check_ldap {
-  read_ldap_config();
-
   # initiate the LDAP connexion
   my %hash_ldap_param = get_ldap_connexion();
 
@@ -1052,8 +1050,6 @@ sub check_ldap {
 
 # function that check for duplicated uid or gid numbers
 sub check_id_numbers {
-  read_ldap_config();
-
   # initiate the LDAP connexion
   my %hash_ldap_param = get_ldap_connexion();
 
@@ -1830,18 +1826,19 @@ die ("! You have to run this script as root\n") if ($<!=0);
 
   my @vars_keys = keys %vars;
 
+  # $commands{<cli-option>} = [<description>, <function>, <needs-ldap-config>];
   my %commands = ();
   $commands{"--update-cache"}         = ["Updating class.cache",                          \&rescan_classes];
   $commands{"--update-locales"}       = ["Updating translations",                         \&rescan_i18n];
   $commands{"--check-directories"}    = ["Checking FusionDirectory's directories",        \&check_directories];
   $commands{"--check-config"}         = ["Checking FusionDirectory's config file",        \&check_config];
-  $commands{"--check-ldap"}           = ["Checking your LDAP tree",                       \&check_ldap];
-  $commands{"--check-ids"}            = ["Checking for duplicated uid or gid numbers",    \&check_id_numbers];
-  $commands{"--migrate-users"}        = ["Migrating your users",                          \&migrate_users];
-  $commands{"--migrate-phones"}       = ["Migrating your phones from FD < 1.1",           \&migrate_phones];
-  $commands{"--migrate-systems"}      = ["Migrating your systems from FD < 1.1",          \&migrate_systems];
-  $commands{"--migrate-winstations"}  = ["Migrating your winstations from FD < 1.1",      \&migrate_winstations];
-  $commands{"--migrate-dhcp"}         = ["Migrating DHCP configurations for FD >= 1.0.17",\&migrate_dhcp];
+  $commands{"--check-ldap"}           = ["Checking your LDAP tree",                       \&check_ldap, 1];
+  $commands{"--check-ids"}            = ["Checking for duplicated uid or gid numbers",    \&check_id_numbers, 1];
+  $commands{"--migrate-users"}        = ["Migrating your users",                          \&migrate_users, 1];
+  $commands{"--migrate-phones"}       = ["Migrating your phones from FD < 1.1",           \&migrate_phones, 1];
+  $commands{"--migrate-systems"}      = ["Migrating your systems from FD < 1.1",          \&migrate_systems, 1];
+  $commands{"--migrate-winstations"}  = ["Migrating your winstations from FD < 1.1",      \&migrate_winstations, 1];
+  $commands{"--migrate-dhcp"}         = ["Migrating DHCP configurations for FD >= 1.0.17",\&migrate_dhcp, 1];
   $commands{"--delete-gosa-locks"}    = ["Delete lock tokens using old gosaLockEntry class", \&delete_gosa_locks];
   $commands{"--install-plugins"}      = ["Installing FusionDirectory's plugins",          \&install_plugins];
   $commands{"--encrypt-passwords"}    = ["Encrypt passwords in fusiondirectory.conf",     \&encrypt_passwords];
@@ -1868,6 +1865,9 @@ die ("! You have to run this script as root\n") if ($<!=0);
       set_config_var($1, $2);
     } elsif ( defined $commands { lc ( $arg ) } ) {
       my @command = @{ $commands{ $arg } };
+      if ((defined $command[2]) && $command[2]) {
+        read_ldap_config();
+      }
       print( $command[0]."\n" );
       $command[1]();
     } elsif ( ( lc($arg) eq "--help" ) || ( lc($arg) eq "-h" ) ) {