Index: trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
===================================================================
--- trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp	(revision 42442)
+++ trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp	(revision 42444)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2012 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -247,5 +247,5 @@
 
 #ifndef VBOX_ONLY_DOCS
-static RTEXITCODE settingsPasswordFile(ComPtr<IVirtualBox> virtualBox, const char *pszFile)
+RTEXITCODE readPasswordFile(const char *pszFilename, com::Utf8Str *pPasswd)
 {
     size_t cbFile;
@@ -253,8 +253,8 @@
     int vrc = VINF_SUCCESS;
     RTEXITCODE rcExit = RTEXITCODE_SUCCESS;
-    bool fStdIn = !strcmp(pszFile, "stdin");
+    bool fStdIn = !strcmp(pszFilename, "stdin");
     PRTSTREAM pStrm;
     if (!fStdIn)
-        vrc = RTStrmOpen(pszFile, "r", &pStrm);
+        vrc = RTStrmOpen(pszFilename, "r", &pStrm);
     else
         pStrm = g_pStdIn;
@@ -265,5 +265,5 @@
         {
             if (cbFile >= sizeof(szPasswd)-1)
-                rcExit = RTMsgErrorExit(RTEXITCODE_FAILURE, "Provided password too long");
+                rcExit = RTMsgErrorExit(RTEXITCODE_FAILURE, "Provided password in file '%s' is too long", pszFilename);
             else
             {
@@ -272,15 +272,29 @@
                     ;
                 szPasswd[i] = '\0';
-                int rc;
-                CHECK_ERROR(virtualBox, SetSettingsSecret(com::Bstr(szPasswd).raw()));
-                if (FAILED(rc))
-                    rcExit = RTEXITCODE_FAILURE;
-            }
-        }
+                *pPasswd = szPasswd;
+            }
+        }
+        else
+            rcExit = RTMsgErrorExit(RTEXITCODE_FAILURE, "Cannot read password from file '%s': %Rrc", pszFilename, vrc);
         if (!fStdIn)
             RTStrmClose(pStrm);
     }
     else
-        rcExit = RTMsgErrorExit(RTEXITCODE_FAILURE, "Cannot open password file '%s' (%Rrc)", pszFile);
+        rcExit = RTMsgErrorExit(RTEXITCODE_FAILURE, "Cannot open password file '%s' (%Rrc)", pszFilename, vrc);
+
+    return rcExit;
+}
+
+static RTEXITCODE settingsPasswordFile(ComPtr<IVirtualBox> virtualBox, const char *pszFilename)
+{
+    com::Utf8Str passwd;
+    RTEXITCODE rcExit = readPasswordFile(pszFilename, &passwd);
+    if (rcExit == RTEXITCODE_SUCCESS)
+    {
+        int rc;
+        CHECK_ERROR(virtualBox, SetSettingsSecret(com::Bstr(passwd).raw()));
+        if (FAILED(rc))
+            rcExit = RTEXITCODE_FAILURE;
+    }
 
     return rcExit;
Index: trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h
===================================================================
--- trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h	(revision 42442)
+++ trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h	(revision 42444)
@@ -162,4 +162,6 @@
 
 #ifndef VBOX_ONLY_DOCS
+RTEXITCODE readPasswordFile(const char *pszFilename, com::Utf8Str *pPasswd);
+
 int handleInternalCommands(HandlerArg *a);
 #endif /* !VBOX_ONLY_DOCS */
Index: trunk/src/VBox/Frontends/VBoxManage/VBoxManageControlVM.cpp
===================================================================
--- trunk/src/VBox/Frontends/VBoxManage/VBoxManageControlVM.cpp	(revision 42442)
+++ trunk/src/VBox/Frontends/VBoxManage/VBoxManageControlVM.cpp	(revision 42444)
@@ -953,8 +953,11 @@
         {
             bool fAllowLocalLogon = true;
-            if (a->argc == 7)
-            {
-                if (   strcmp(a->argv[5], "--allowlocallogon")
-                    && strcmp(a->argv[5], "-allowlocallogon"))
+            if (   a->argc == 7
+                || (   a->argc == 8
+                    && (   !strcmp(a->argv[3], "-p")
+                        || !strcmp(a->argv[3], "--passwordfile"))))
+            {
+                if (   strcmp(a->argv[5 + (a->argc - 7)], "--allowlocallogon")
+                    && strcmp(a->argv[5 + (a->argc - 7)], "-allowlocallogon"))
                 {
                     errorArgument("Invalid parameter '%s'", a->argv[5]);
@@ -962,12 +965,31 @@
                     break;
                 }
-                if (!strcmp(a->argv[6], "no"))
+                if (!strcmp(a->argv[6 + (a->argc - 7)], "no"))
                     fAllowLocalLogon = false;
             }
-            else if (a->argc != 5)
+            else if (   a->argc != 5
+                     && (   a->argc != 6
+                         || (   strcmp(a->argv[3], "-p")
+                             && strcmp(a->argv[3], "--passwordfile"))))
             {
                 errorSyntax(USAGE_CONTROLVM, "Incorrect number of parameters");
                 rc = E_FAIL;
                 break;
+            }
+            Utf8Str passwd, domain;
+            if (a->argc == 5 || a->argc == 7)
+            {
+                passwd = a->argv[3];
+                domain = a->argv[4];
+            }
+            else
+            {
+                RTEXITCODE rcExit = readPasswordFile(a->argv[4], &passwd);
+                if (rcExit != RTEXITCODE_SUCCESS)
+                {
+                    rc = E_FAIL;
+                    break;
+                }
+                domain = a->argv[5];
             }
 
@@ -975,6 +997,6 @@
             CHECK_ERROR_BREAK(console, COMGETTER(Guest)(guest.asOutParam()));
             CHECK_ERROR_BREAK(guest, SetCredentials(Bstr(a->argv[2]).raw(),
-                                                    Bstr(a->argv[3]).raw(),
-                                                    Bstr(a->argv[4]).raw(),
+                                                    Bstr(passwd).raw(),
+                                                    Bstr(domain).raw(),
                                                     fAllowLocalLogon));
         }
Index: trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp
===================================================================
--- trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp	(revision 42442)
+++ trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp	(revision 42444)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2010-2011 Oracle Corporation
+ * Copyright (C) 2010-2012 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -183,4 +183,5 @@
     GETOPTDEF_EXEC_DOS2UNIX,
     GETOPTDEF_EXEC_UNIX2DOS,
+    GETOPTDEF_EXEC_PASSWORD,
     GETOPTDEF_EXEC_WAITFOREXIT,
     GETOPTDEF_EXEC_WAITFORSTDOUT,
@@ -188,32 +189,20 @@
 };
 
-enum GETOPTDEF_COPYFROM
-{
-    GETOPTDEF_COPYFROM_DRYRUN = 1000,
-    GETOPTDEF_COPYFROM_FOLLOW,
-    GETOPTDEF_COPYFROM_PASSWORD,
-    GETOPTDEF_COPYFROM_TARGETDIR,
-    GETOPTDEF_COPYFROM_USERNAME
+enum GETOPTDEF_COPY
+{
+    GETOPTDEF_COPY_DRYRUN = 1000,
+    GETOPTDEF_COPY_FOLLOW,
+    GETOPTDEF_COPY_PASSWORD,
+    GETOPTDEF_COPY_TARGETDIR
 };
 
-enum GETOPTDEF_COPYTO
-{
-    GETOPTDEF_COPYTO_DRYRUN = 1000,
-    GETOPTDEF_COPYTO_FOLLOW,
-    GETOPTDEF_COPYTO_PASSWORD,
-    GETOPTDEF_COPYTO_TARGETDIR,
-    GETOPTDEF_COPYTO_USERNAME
+enum GETOPTDEF_MKDIR
+{
+    GETOPTDEF_MKDIR_PASSWORD = 1000
 };
 
-enum GETOPTDEF_MKDIR
-{
-    GETOPTDEF_MKDIR_PASSWORD = 1000,
-    GETOPTDEF_MKDIR_USERNAME
-};
-
 enum GETOPTDEF_STAT
 {
-    GETOPTDEF_STAT_PASSWORD = 1000,
-    GETOPTDEF_STAT_USERNAME
+    GETOPTDEF_STAT_PASSWORD = 1000
 };
 
@@ -234,10 +223,10 @@
                  "VBoxManage guestcontrol     <vmname>|<uuid>\n"
                  "                            exec[ute]\n"
-                 "                            --image <path to program>\n"
-                 "                            --username <name> --password <password>\n"
-                 "                            [--dos2unix]\n"
+                 "                            --image <path to program> --username <name>\n"
+                 "                            --passwordfile <file> | --password <password>\n"
                  "                            [--environment \"<NAME>=<VALUE> [<NAME>=<VALUE>]\"]\n"
-                 "                            [--timeout <msec>] [--unix2dos] [--verbose]\n"
+                 "                            [--verbose] [--timeout <msec>]\n"
                  "                            [--wait-exit] [--wait-stdout] [--wait-stderr]\n"
+                 "                            [--dos2unix] [--unix2dos]\n"
                  "                            [-- [<argument1>] ... [<argumentN>]]\n"
                  /** @todo Add a "--" parameter (has to be last parameter) to directly execute
@@ -245,21 +234,21 @@
                  "\n"
                  "                            copyfrom\n"
-                 "                            <source on guest> <destination on host>\n"
-                 "                            --username <name> --password <password>\n"
+                 "                            <guest source> <host dest> --username <name>\n"
+                 "                            --passwordfile <file> | --password <password>\n"
                  "                            [--dryrun] [--follow] [--recursive] [--verbose]\n"
                  "\n"
                  "                            copyto|cp\n"
-                 "                            <source on host> <destination on guest>\n"
-                 "                            --username <name> --password <password>\n"
+                 "                            <host source> <guest dest> --username <name>\n"
+                 "                            --passwordfile <file> | --password <password>\n"
                  "                            [--dryrun] [--follow] [--recursive] [--verbose]\n"
                  "\n"
                  "                            createdir[ectory]|mkdir|md\n"
-                 "                            <director[y|ies] to create on guest>\n"
-                 "                            --username <name> --password <password>\n"
+                 "                            <guest directory>... --username <name>\n"
+                 "                            --passwordfile <file> | --password <password>\n"
                  "                            [--parents] [--mode <mode>] [--verbose]\n"
                  "\n"
                  "                            stat\n"
-                 "                            <file element(s) to check on guest>\n"
-                 "                            --username <name> --password <password>\n"
+                 "                            <file>... --username <name>\n"
+                 "                            --passwordfile <file> | --password <password>\n"
                  "                            [--verbose]\n"
                  "\n"
@@ -597,5 +586,5 @@
 }
 
-/* <Missing docuemntation> */
+/* <Missing documentation> */
 static int handleCtrlExecProgram(ComPtr<IGuest> pGuest, HandlerArg *pArg)
 {
@@ -616,5 +605,6 @@
         { "--image",                        'i',                                      RTGETOPT_REQ_STRING  },
         { "--no-profile",                   GETOPTDEF_EXEC_NO_PROFILE,                RTGETOPT_REQ_NOTHING },
-        { "--password",                     'p',                                      RTGETOPT_REQ_STRING  },
+        { "--passwordfile",                 'p',                                      RTGETOPT_REQ_STRING  },
+        { "--password",                     GETOPTDEF_EXEC_PASSWORD,                  RTGETOPT_REQ_STRING  },
         { "--timeout",                      't',                                      RTGETOPT_REQ_UINT32  },
         { "--unix2dos",                     GETOPTDEF_EXEC_UNIX2DOS,                  RTGETOPT_REQ_NOTHING },
@@ -685,7 +675,15 @@
             /** @todo Add a hidden flag. */
 
-            case 'p': /* Password */
+            case GETOPTDEF_EXEC_PASSWORD: /* Password */
                 Utf8Password = ValueUnion.psz;
                 break;
+
+            case 'p': /* Password file */
+            {
+                RTEXITCODE rcExit = readPasswordFile(ValueUnion.psz, &Utf8Password);
+                if (rcExit != RTEXITCODE_SUCCESS)
+                    return rcExit;
+                break;
+            }
 
             case 't': /* Timeout */
@@ -761,5 +759,5 @@
 
     /* Execute the process. */
-    int rcProc = RTEXITCODE_FAILURE;
+    int rcExit = RTEXITCODE_FAILURE;
     ComPtr<IProgress> progress;
     ULONG uPID = 0;
@@ -872,5 +870,5 @@
             if (fVerbose)
                 RTPrintf("Process execution canceled!\n");
-            rcProc = EXITCODEEXEC_CANCELED;
+            rcExit = EXITCODEEXEC_CANCELED;
         }
         else if (   fCompleted
@@ -890,10 +888,10 @@
                     if (fVerbose)
                         RTPrintf("Exit code=%u (Status=%u [%s], Flags=%u)\n", uRetExitCode, retStatus, ctrlExecProcessStatusToText(retStatus), uRetFlags);
-                    rcProc = ctrlExecProcessStatusToExitCode(retStatus, uRetExitCode);
+                    rcExit = ctrlExecProcessStatusToExitCode(retStatus, uRetExitCode);
                 }
                 else
                 {
                     ctrlPrintError(pGuest, COM_IIDOF(IGuest));
-                    rcProc = RTEXITCODE_FAILURE;
+                    rcExit = RTEXITCODE_FAILURE;
                 }
             }
@@ -903,5 +901,5 @@
             if (fVerbose)
                 RTPrintf("Process execution aborted!\n");
-            rcProc = EXITCODEEXEC_TERM_ABEND;
+            rcExit = EXITCODEEXEC_TERM_ABEND;
         }
     }
@@ -909,5 +907,5 @@
     if (RT_FAILURE(vrc) || FAILED(rc))
         return RTEXITCODE_FAILURE;
-    return rcProc;
+    return rcExit;
 }
 
@@ -1799,6 +1797,6 @@
 }
 
-static int handleCtrlCopyTo(ComPtr<IGuest> guest, HandlerArg *pArg,
-                            bool fHostToGuest)
+static int handleCtrlCopy(ComPtr<IGuest> guest, HandlerArg *pArg,
+                          bool fHostToGuest)
 {
     AssertPtrReturn(pArg, VERR_INVALID_PARAMETER);
@@ -1820,10 +1818,11 @@
     static const RTGETOPTDEF s_aOptions[] =
     {
-        { "--dryrun",              GETOPTDEF_COPYTO_DRYRUN,         RTGETOPT_REQ_NOTHING },
-        { "--follow",              GETOPTDEF_COPYTO_FOLLOW,         RTGETOPT_REQ_NOTHING },
-        { "--password",            GETOPTDEF_COPYTO_PASSWORD,       RTGETOPT_REQ_STRING  },
+        { "--dryrun",              GETOPTDEF_COPY_DRYRUN,           RTGETOPT_REQ_NOTHING },
+        { "--follow",              GETOPTDEF_COPY_FOLLOW,           RTGETOPT_REQ_NOTHING },
+        { "--passwordfile",        'p',                             RTGETOPT_REQ_STRING  },
+        { "--password",            GETOPTDEF_COPY_PASSWORD,         RTGETOPT_REQ_STRING  },
         { "--recursive",           'R',                             RTGETOPT_REQ_NOTHING },
-        { "--target-directory",    GETOPTDEF_COPYTO_TARGETDIR,      RTGETOPT_REQ_STRING  },
-        { "--username",            GETOPTDEF_COPYTO_USERNAME,       RTGETOPT_REQ_STRING  },
+        { "--target-directory",    GETOPTDEF_COPY_TARGETDIR,        RTGETOPT_REQ_STRING  },
+        { "--username",            'u',                             RTGETOPT_REQ_STRING  },
         { "--verbose",             'v',                             RTGETOPT_REQ_NOTHING }
     };
@@ -1852,15 +1851,23 @@
         switch (ch)
         {
-            case GETOPTDEF_COPYTO_DRYRUN:
+            case GETOPTDEF_COPY_DRYRUN:
                 fDryRun = true;
                 break;
 
-            case GETOPTDEF_COPYTO_FOLLOW:
+            case GETOPTDEF_COPY_FOLLOW:
                 fFlags |= CopyFileFlag_FollowLinks;
                 break;
 
-            case GETOPTDEF_COPYTO_PASSWORD:
+            case GETOPTDEF_COPY_PASSWORD: /* Password */
                 Utf8Password = ValueUnion.psz;
                 break;
+
+            case 'p': /* Password file */
+            {
+                RTEXITCODE rcExit = readPasswordFile(ValueUnion.psz, &Utf8Password);
+                if (rcExit != RTEXITCODE_SUCCESS)
+                    return rcExit;
+                break;
+            }
 
             case 'R': /* Recursive processing */
@@ -1868,9 +1875,9 @@
                 break;
 
-            case GETOPTDEF_COPYTO_TARGETDIR:
+            case GETOPTDEF_COPY_TARGETDIR:
                 Utf8Dest = ValueUnion.psz;
                 break;
 
-            case GETOPTDEF_COPYTO_USERNAME:
+            case 'u': /* User name */
                 Utf8UserName = ValueUnion.psz;
                 break;
@@ -2081,6 +2088,7 @@
         { "--mode",                'm',                             RTGETOPT_REQ_UINT32  },
         { "--parents",             'P',                             RTGETOPT_REQ_NOTHING },
+        { "--passwordfile",        'p',                             RTGETOPT_REQ_STRING  },
         { "--password",            GETOPTDEF_MKDIR_PASSWORD,        RTGETOPT_REQ_STRING  },
-        { "--username",            GETOPTDEF_MKDIR_USERNAME,        RTGETOPT_REQ_STRING  },
+        { "--username",            'u',                             RTGETOPT_REQ_STRING  },
         { "--verbose",             'v',                             RTGETOPT_REQ_NOTHING }
     };
@@ -2100,7 +2108,5 @@
     DESTDIRMAP mapDirs;
 
-    RTEXITCODE rcExit = RTEXITCODE_SUCCESS;
-    while (   (ch = RTGetOpt(&GetState, &ValueUnion))
-           && rcExit == RTEXITCODE_SUCCESS)
+    while ((ch = RTGetOpt(&GetState, &ValueUnion)))
     {
         /* For options that require an argument, ValueUnion has received the value. */
@@ -2119,5 +2125,13 @@
                 break;
 
-            case GETOPTDEF_MKDIR_USERNAME: /* User name */
+            case 'p': /* Password file */
+            {
+                RTEXITCODE rcExit = readPasswordFile(ValueUnion.psz, &Utf8Password);
+                if (rcExit != RTEXITCODE_SUCCESS)
+                    return rcExit;
+                break;
+            }
+
+            case 'u': /* User name */
                 Utf8UserName = ValueUnion.psz;
                 break;
@@ -2134,48 +2148,41 @@
 
             default:
-                rcExit = RTGetOptPrintError(ch, &ValueUnion);
-                break;
+                return RTGetOptPrintError(ch, &ValueUnion);
         }
     }
 
     uint32_t cDirs = mapDirs.size();
-    if (rcExit == RTEXITCODE_SUCCESS && !cDirs)
-        rcExit = errorSyntax(USAGE_GUESTCONTROL, "No directory to create specified!");
-
-    if (rcExit == RTEXITCODE_SUCCESS && Utf8UserName.isEmpty())
-        rcExit = errorSyntax(USAGE_GUESTCONTROL, "No user name specified!");
-
-    if (rcExit == RTEXITCODE_SUCCESS)
-    {
-        /*
-         * Create the directories.
-         */
-        HRESULT hrc = S_OK;
-        if (fVerbose && cDirs)
-            RTPrintf("Creating %u directories ...\n", cDirs);
-
-        DESTDIRMAPITER it = mapDirs.begin();
-        while (it != mapDirs.end())
-        {
-            if (fVerbose)
-                RTPrintf("Creating directory \"%s\" ...\n", it->first.c_str());
-
-            hrc = guest->DirectoryCreate(Bstr(it->first).raw(),
-                                         Bstr(Utf8UserName).raw(), Bstr(Utf8Password).raw(),
-                                         fDirMode, fFlags);
-            if (FAILED(hrc))
-            {
-                ctrlPrintError(guest, COM_IIDOF(IGuest)); /* Return code ignored, save original rc. */
-                break;
-            }
-
-            it++;
-        }
-
+    if (!cDirs)
+        return errorSyntax(USAGE_GUESTCONTROL, "No directory to create specified!");
+
+    if (Utf8UserName.isEmpty())
+        return errorSyntax(USAGE_GUESTCONTROL, "No user name specified!");
+
+    /*
+     * Create the directories.
+     */
+    HRESULT hrc = S_OK;
+    if (fVerbose && cDirs)
+        RTPrintf("Creating %u directories ...\n", cDirs);
+
+    DESTDIRMAPITER it = mapDirs.begin();
+    while (it != mapDirs.end())
+    {
+        if (fVerbose)
+            RTPrintf("Creating directory \"%s\" ...\n", it->first.c_str());
+
+        hrc = guest->DirectoryCreate(Bstr(it->first).raw(),
+                                     Bstr(Utf8UserName).raw(), Bstr(Utf8Password).raw(),
+                                     fDirMode, fFlags);
         if (FAILED(hrc))
-            rcExit = RTEXITCODE_FAILURE;
-    }
-
-    return rcExit;
+        {
+            ctrlPrintError(guest, COM_IIDOF(IGuest)); /* Return code ignored, save original rc. */
+            break;
+        }
+
+        it++;
+    }
+
+    return FAILED(hrc) ? RTEXITCODE_FAILURE : RTEXITCODE_SUCCESS;
 }
 
@@ -2189,7 +2196,8 @@
         { "--file-system",         'f',                             RTGETOPT_REQ_NOTHING },
         { "--format",              'c',                             RTGETOPT_REQ_STRING },
+        { "--passwordfile",        'p',                             RTGETOPT_REQ_STRING  },
         { "--password",            GETOPTDEF_STAT_PASSWORD,         RTGETOPT_REQ_STRING  },
         { "--terse",               't',                             RTGETOPT_REQ_NOTHING },
-        { "--username",            GETOPTDEF_STAT_USERNAME,         RTGETOPT_REQ_STRING  },
+        { "--username",            'u',                             RTGETOPT_REQ_STRING  },
         { "--verbose",             'v',                             RTGETOPT_REQ_NOTHING }
     };
@@ -2207,7 +2215,5 @@
     DESTDIRMAP mapObjs;
 
-    RTEXITCODE rcExit = RTEXITCODE_SUCCESS;
-    while (   (ch = RTGetOpt(&GetState, &ValueUnion))
-           && rcExit == RTEXITCODE_SUCCESS)
+    while ((ch = RTGetOpt(&GetState, &ValueUnion)))
     {
         /* For options that require an argument, ValueUnion has received the value. */
@@ -2218,5 +2224,13 @@
                 break;
 
-            case GETOPTDEF_STAT_USERNAME: /* User name */
+            case 'p': /* Password file */
+            {
+                RTEXITCODE rcExit = readPasswordFile(ValueUnion.psz, &Utf8Password);
+                if (rcExit != RTEXITCODE_SUCCESS)
+                    return rcExit;
+                break;
+            }
+
+            case 'u': /* User name */
                 Utf8UserName = ValueUnion.psz;
                 break;
@@ -2242,58 +2256,51 @@
             default:
                 return RTGetOptPrintError(ch, &ValueUnion);
-                break; /* Never reached. */
         }
     }
 
     uint32_t cObjs = mapObjs.size();
-    if (rcExit == RTEXITCODE_SUCCESS && !cObjs)
-        rcExit = errorSyntax(USAGE_GUESTCONTROL, "No element(s) to check specified!");
-
-    if (rcExit == RTEXITCODE_SUCCESS && Utf8UserName.isEmpty())
-        rcExit = errorSyntax(USAGE_GUESTCONTROL, "No user name specified!");
-
-    if (rcExit == RTEXITCODE_SUCCESS)
-    {
-        /*
-         * Create the directories.
-         */
-        HRESULT hrc = S_OK;
-
-        DESTDIRMAPITER it = mapObjs.begin();
-        while (it != mapObjs.end())
-        {
-            if (fVerbose)
-                RTPrintf("Checking for element \"%s\" ...\n", it->first.c_str());
-
-            BOOL fExists;
-            hrc = guest->FileExists(Bstr(it->first).raw(),
-                                    Bstr(Utf8UserName).raw(), Bstr(Utf8Password).raw(),
-                                    &fExists);
-            if (FAILED(hrc))
-            {
-                ctrlPrintError(guest, COM_IIDOF(IGuest)); /* Return code ignored, save original rc. */
-                break;
-            }
-            else
-            {
-                /** @todo: Output vbox_stat's stdout output to get more information about
-                 *         what happened. */
-
-                /* If there's at least one element which does not exist on the guest,
-                 * drop out with exitcode 1. */
-                if (!fExists)
-                {
-                    if (fVerbose)
-                        RTPrintf("Cannot stat for element \"%s\": No such file or directory\n",
-                                 it->first.c_str());
-                    rcExit = RTEXITCODE_FAILURE;
-                }
-            }
-
-            it++;
-        }
-
+    if (!cObjs)
+        return errorSyntax(USAGE_GUESTCONTROL, "No element(s) to check specified!");
+
+    if (Utf8UserName.isEmpty())
+        return errorSyntax(USAGE_GUESTCONTROL, "No user name specified!");
+
+    /*
+     * Create the directories.
+     */
+    HRESULT hrc = S_OK;
+    RTEXITCODE rcExit = RTEXITCODE_SUCCESS;
+    DESTDIRMAPITER it = mapObjs.begin();
+    while (it != mapObjs.end())
+    {
+        if (fVerbose)
+            RTPrintf("Checking for element \"%s\" ...\n", it->first.c_str());
+
+        BOOL fExists;
+        hrc = guest->FileExists(Bstr(it->first).raw(),
+                                Bstr(Utf8UserName).raw(), Bstr(Utf8Password).raw(),
+                                &fExists);
         if (FAILED(hrc))
+        {
+            ctrlPrintError(guest, COM_IIDOF(IGuest)); /* Return code ignored, save original rc. */
             rcExit = RTEXITCODE_FAILURE;
+        }
+        else
+        {
+            /** @todo: Output vbox_stat's stdout output to get more information about
+             *         what happened. */
+
+            /* If there's at least one element which does not exist on the guest,
+             * drop out with exitcode 1. */
+            if (!fExists)
+            {
+                if (fVerbose)
+                    RTPrintf("Cannot stat for element \"%s\": No such file or directory\n",
+                             it->first.c_str());
+                rcExit = RTEXITCODE_FAILURE;
+            }
+        }
+
+        it++;
     }
 
@@ -2443,8 +2450,8 @@
             rcExit = handleCtrlExecProgram(guest, &arg);
         else if (!strcmp(pArg->argv[1], "copyfrom"))
-            rcExit = handleCtrlCopyTo(guest, &arg, false /* Guest to host */);
+            rcExit = handleCtrlCopy(guest, &arg, false /* Guest to host */);
         else if (   !strcmp(pArg->argv[1], "copyto")
                  || !strcmp(pArg->argv[1], "cp"))
-            rcExit = handleCtrlCopyTo(guest, &arg, true /* Host to guest */);
+            rcExit = handleCtrlCopy(guest, &arg, true /* Host to guest */);
         else if (   !strcmp(pArg->argv[1], "createdirectory")
                  || !strcmp(pArg->argv[1], "createdir")
Index: trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
===================================================================
--- trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp	(revision 42442)
+++ trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp	(revision 42444)
@@ -439,5 +439,7 @@
                      "                                              [<xorigin> <yorigin>]]] |\n"
                      "                            screenshotpng <file> [display] |\n"
-                     "                            setcredentials <username> <password> <domain>\n"
+                     "                            setcredentials <username>\n"
+                     "                                           --passwordfile <file> | <password>\n"
+                     "                                           <domain>\n"
                      "                                           [--allowlocallogon <yes|no>] |\n"
                      "                            teleport --host <name> --port <port>\n"
