Index: /trunk/doc/manual/Makefile.kmk
===================================================================
--- /trunk/doc/manual/Makefile.kmk	(revision 68139)
+++ /trunk/doc/manual/Makefile.kmk	(revision 68140)
@@ -192,5 +192,6 @@
 VBOX_MANUAL_XML_REFENTRY_FILES = \
 	man_VBoxManage-debugvm.xml \
-	man_VBoxManage-extpack.xml
+	man_VBoxManage-extpack.xml \
+	man_VBoxManage-unattended.xml
 
 
Index: /trunk/doc/manual/en_US/man_VBoxManage-unattended.xml
===================================================================
--- /trunk/doc/manual/en_US/man_VBoxManage-unattended.xml	(revision 68139)
+++ /trunk/doc/manual/en_US/man_VBoxManage-unattended.xml	(revision 68140)
@@ -37,8 +37,14 @@
 
   <refsynopsisdiv>
-    <cmdsynopsis id="synopsis-vboxmanage-unattended"> <!-- The 'id' is mandatory and must start with 'synopsis-'. -->
-      <command>VBoxManage unattended</command>
+    <cmdsynopsis id="synopsis-vboxmanage-unattended-detect"> <!-- The 'id' is mandatory and must start with 'synopsis-'. -->
+      <command>VBoxManage unattended detect</command>
+      <arg choice="req">--iso=<replaceable>install-iso</replaceable></arg>
+      <arg>--machine-readable</arg>
+    </cmdsynopsis>
+    <cmdsynopsis id="synopsis-vboxmanage-unattended-install"> <!-- The 'id' is mandatory and must start with 'synopsis-'. -->
+      <command>VBoxManage unattended install</command>
       <arg choice="req"><replaceable>uuid|vmname</replaceable></arg>
-      <arg choice="req">--iso-path=<replaceable>install-iso</replaceable></arg>
+      <arg choice="req">--iso=<replaceable>install-iso</replaceable></arg>
+      <arg choice="req">incomplete</arg>
     </cmdsynopsis>
   </refsynopsisdiv>
@@ -47,9 +53,29 @@
     <title>Description</title>
 
-    <refsect2 id="vboxmanage-unattended">
-      <title>unattended installation</title>
+    <refsect2 id="vboxmanage-unattended-detect">
+      <title>unattended detect</title>
       <remark role="help-copy-synopsis"/>
       <para>
-        docs.
+        Detects the guest operating system (OS) on the specified installation ISO
+        and displays the result.  This can be used as input when creating a VM for
+        the ISO to be installed in.
+      </para>
+      <variablelist>
+        <varlistentry>
+          <term><option>--iso=<replaceable>install-iso</replaceable></option></term>
+          <listitem><para>The installation ISO to run the detection on.</para></listitem>
+        </varlistentry>
+        <varlistentry>
+          <term><option>--machine-readable</option></term>
+          <listitem><para>Produce output that is simpler to parse from a script.</para></listitem>
+        </varlistentry>
+      </variablelist>
+    </refsect2>
+
+    <refsect2 id="vboxmanage-unattended-install">
+      <title>unattended install</title>
+      <remark role="help-copy-synopsis"/>
+      <para>
+        Reconfigures the specified VM for installation and optionally starts it up.
       </para>
       <variablelist>
@@ -58,4 +84,9 @@
           <listitem><para>Either the UUID or the name (case sensitive) of a VM.</para></listitem>
         </varlistentry>
+        <varlistentry>
+          <term><option>--iso=<replaceable>install-iso</replaceable></option></term>
+          <listitem><para>The installation ISO to run the detection on.</para></listitem>
+        </varlistentry>
+        <!-- a lot more stuff here to document. -->
       </variablelist>
     </refsect2>
Index: /trunk/doc/manual/en_US/user_VBoxManage.xml
===================================================================
--- /trunk/doc/manual/en_US/user_VBoxManage.xml	(revision 68139)
+++ /trunk/doc/manual/en_US/user_VBoxManage.xml	(revision 68140)
@@ -2687,159 +2687,4 @@
   </sect1>
 
-<sect1 id="vboxmanage-unattended">
-    <title>VBoxManage unattended</title>
- 
-    <para>The <computeroutput>unattended</computeroutput> subcommand allows you to run unattended
-    guest installation from the command line.
-    User is able to choose passing the settings for unattended installation via:
-      <itemizedlist>
-        <listitem>
-          <para>passing the data via a file with prepared settings using
-          <computeroutput>VBoxManage unattended usefile</computeroutput>
-          </para>
-          <itemizedlist>
-            <listitem>
-              <para><computeroutput>--settingfile
-              &lt;file&gt;</computeroutput>:
-              specifies a file with all settings needed for unattended installation. </para>
-            </listitem>
-          </itemizedlist>
- 
-          <para>In this case correctness of all settings and data lays upon on the user.</para>
- 
-        </listitem>
- 
-        <listitem>
-          <para>the command line using
-          <computeroutput>VBoxManage unattended usedata</computeroutput></para>
-          <para>Command line settings are:</para>
-          <itemizedlist>
-            <listitem>
-              <para><computeroutput>--user
-              &lt;user name&gt;</computeroutput>:
-              specifies a login name for the guest OS. </para>
-            </listitem>
- 
-            <listitem>
-              <para><computeroutput>--password
-              &lt;password&gt;</computeroutput>:
-              user's password for the logging to the guest OS. </para>
-            </listitem>
- 
-            <listitem>
-              <para><computeroutput>--key
-              &lt;key&gt;</computeroutput>:
-              product key for validating the installed OS. </para>
-            </listitem>
- 
-            <listitem>
-              <para><computeroutput>--isopath
-              &lt;OS ISO path&gt;</computeroutput>:
-              CD\DVD disk or ISO image with OS installation data. </para>
-            </listitem>
- 
-            <listitem>
-               <para><computeroutput>--addisopath
-              &lt;additions ISO path&gt;</computeroutput>:
-              ISO image with Virtualbox additions. Optional. </para>
-            </listitem>
- 
-            <listitem>
-              <para><computeroutput>--imageindex
-              &lt;number&gt;</computeroutput>:
-              The installation disk can contains the several images of OS (for example 32bits and 64bits systems).
-              At moment used only for Windows OS installation. Optional.
-              </para>
-            </listitem>
- 
-          </itemizedlist>
-        </listitem>
-      </itemizedlist>
-    </para>
- 
-    <para>The setting file has a simple structure as "key equal sign value".
-    One key is one line, at moment there are eight settings which supported by the command:
-      <itemizedlist>
-        <listitem>
-          <para><computeroutput>
-          username</computeroutput>:
-           See above description for "--username"</para>
-        </listitem>
- 
-        <listitem>
-          <para><computeroutput>
-          password</computeroutput>:
-          See above description for "--password"</para>
-        </listitem>
- 
-        <listitem>
-          <para><computeroutput>
-          key</computeroutput>:
-          See above description for "--key"</para>
-        </listitem>
- 
-        <listitem>
-          <para><computeroutput>
-          installation_iso</computeroutput>:
-          See above description for "--isopath"</para>
-        </listitem>
- 
-        <listitem>
-          <para><computeroutput>
-          addition_iso</computeroutput>:
-          See above description for "--addisopath"</para>
-        </listitem>
- 
-        <listitem>
-          <para><computeroutput>
-          aux_iso</computeroutput>:
-          Auxiliary CD disk which can be used during installation as simple bootable CD with unattended script on it.
-          Generally used for Linux installation.</para>
-        </listitem>
- 
-        <listitem>
-          <para><computeroutput>
-          aux_floppy</computeroutput>:
-          Auxiliary floppy disk which can be used during installation as source of unattended script used by the installer.
-          Generally used for Windows installation.
-          </para>
-        </listitem>
- 
-        <listitem>
-          <para><computeroutput>
-          image_index</computeroutput>:
-          See above description for "--imageindex".</para>
-        </listitem>
-      </itemizedlist>
-        <note>
-          <para>The most of parameters are the same parameters as passed via the command line
-          and two of them are related to two items which can be created on the fly during installation (it's auxiliary floppy and CD).
-          </para>
-        </note>
-    </para>
- 
-    <para>
-    Example "VBoxManage unattended usedata":
-    </para>
-    <para>
-    <computeroutput>
-    VBoxManage unattended 2a524618-dd30-4168-bd53-645d9d72bb25 usedata 
-    --user smith 
-    --password smile 
-    --isopath /path/to/the/distributive/ubuntu-16.04.1-server-amd64.iso 
-    --addisopath /path/to/Virtualbox/additions/VBoxGuestAdditions.iso 
-    </computeroutput>
-    </para>
-
-    <para>
-    Example "VBoxManage unattended usefile":
-    </para>
-    <para><computeroutput>
-    VBoxManage unattended 2a524618-dd30-4168-bd53-645d9d72bb25 usefile 
-    --settingfile /path/to/the/file/unattended_settings.txt 
-    </computeroutput></para>
-
-  </sect1> 
-
   <sect1>
     <title>VBoxManage discardstate</title>
@@ -5943,8 +5788,6 @@
 
 
-  <xi:include href="user_man_VBoxManage-debugvm.xml" xpointer="element(/1)"
-    xmlns:xi="http://www.w3.org/2001/XInclude" />
-
-  <xi:include href="user_man_VBoxManage-extpack.xml" xpointer="element(/1)"
-    xmlns:xi="http://www.w3.org/2001/XInclude" />
+  <xi:include href="user_man_VBoxManage-debugvm.xml"    xpointer="element(/1)" xmlns:xi="http://www.w3.org/2001/XInclude" />
+  <xi:include href="user_man_VBoxManage-extpack.xml"    xpointer="element(/1)" xmlns:xi="http://www.w3.org/2001/XInclude" />
+  <xi:include href="user_man_VBoxManage-unattended.xml" xpointer="element(/1)" xmlns:xi="http://www.w3.org/2001/XInclude" />
 </chapter>
Index: /trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp	(revision 68139)
+++ /trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp	(revision 68140)
@@ -120,5 +120,5 @@
     { "startvm",            USAGE_STARTVM,          VBMG_CMD_TODO, handleStartVM,              0 },
     { "controlvm",          USAGE_CONTROLVM,        VBMG_CMD_TODO, handleControlVM,            0 },
-    { "unattended",         USAGE_UNATTENDEDINSTALL,VBMG_CMD_TODO, handleUnattendedInstall,    0 },
+    { "unattended",         USAGE_UNATTENDEDINSTALL, HELP_CMD_UNATTENDED, handleUnattended,    0 },
     { "discardstate",       USAGE_DISCARDSTATE,     VBMG_CMD_TODO, handleDiscardState,         0 },
     { "adoptstate",         USAGE_ADOPTSTATE,       VBMG_CMD_TODO, handleAdoptState,           0 },
Index: /trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h
===================================================================
--- /trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h	(revision 68139)
+++ /trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h	(revision 68140)
@@ -216,5 +216,4 @@
 /* VBoxManageControlVM.cpp */
 RTEXITCODE handleControlVM(HandlerArg *a);
-RTEXITCODE handleUnattendedInstall(HandlerArg *a);
 #ifndef VBOX_ONLY_DOCS
 unsigned int getMaxNics(IVirtualBox* vbox, IMachine* mach);
@@ -277,4 +276,5 @@
 RTEXITCODE handleSharedFolder(HandlerArg *a);
 RTEXITCODE handleExtPack(HandlerArg *a);
+RTEXITCODE handleUnattended(HandlerArg *a);
 
 /* VBoxManageDisk.cpp */
Index: /trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp	(revision 68139)
+++ /trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp	(revision 68140)
@@ -1021,20 +1021,4 @@
     }
 
-    if (fCategory & USAGE_UNATTENDEDINSTALL)
-        RTStrmPrintf(pStrm, /* This will be replaced by a docbook man page. */
-                           "%s unattended %s      <uuid|vmname>\n"
-                     "         <OUTDATED-TODO>    --settings-file <file>\n"
-                     "         <OUTDATED-TODO>    [--session-type <type>]\n"
-                           "%s unattended %s      <uuid|vmname>\n"
-                     "         <OUTDATED-TODO>    --user <user>\n"
-                     "         <OUTDATED-TODO>    --password <password>\n"
-                     "         <OUTDATED-TODO>    --iso-path <path>\n"
-                     "         <OUTDATED-TODO>    [--key <CD-key>]\n"
-                     "         <OUTDATED-TODO>    [--additions-iso-path <path>]\n"
-                     "         <OUTDATED-TODO>    [--install-additions]\n"
-                     "         <OUTDATED-TODO>    [--image-index <index>]\n"
-                     "         <OUTDATED-TODO>    [--session-type <type>]\n"
-                     "\n", SEP, SEP);
-
     if (fCategory & USAGE_DISCARDSTATE)
         RTStrmPrintf(pStrm,
Index: /trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp	(revision 68139)
+++ /trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp	(revision 68140)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2006-2016 Oracle Corporation
+ * Copyright (C) 2006-2017 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -1268,4 +1268,100 @@
 }
 
+RTEXITCODE handleUnattendedDetect(HandlerArg *a)
+{
+    HRESULT hrc;
+
+    /*
+     * Options.  We work directly on an IUnattended instace while parsing
+     * the options.  This saves a lot of extra clutter.
+     */
+    bool    fMachineReadable = false;
+    char    szIsoPath[RTPATH_MAX];
+    szIsoPath[0] = '\0';
+
+    /*
+     * Parse options.
+     */
+    static const RTGETOPTDEF s_aOptions[] =
+    {
+        { "--iso",                              'i', RTGETOPT_REQ_STRING },
+        { "--machine-readable",                 'M', RTGETOPT_REQ_NOTHING },
+    };
+
+    RTGETOPTSTATE GetState;
+    int vrc = RTGetOptInit(&GetState, a->argc, a->argv, s_aOptions, RT_ELEMENTS(s_aOptions), 0, RTGETOPTINIT_FLAGS_OPTS_FIRST);
+    AssertRCReturn(vrc, RTEXITCODE_FAILURE);
+
+    int c;
+    RTGETOPTUNION ValueUnion;
+    while ((c = RTGetOpt(&GetState, &ValueUnion)) != 0)
+    {
+        switch (c)
+        {
+            case 'i': // --iso
+                vrc = RTPathAbs(ValueUnion.psz, szIsoPath, sizeof(szIsoPath));
+                if (RT_FAILURE(vrc))
+                    return errorSyntax("RTPathAbs failed on '%s': %Rrc", ValueUnion.psz, vrc);
+                break;
+
+            case 'M': // --machine-readable.
+                fMachineReadable = true;
+                break;
+
+            default:
+                return errorGetOpt(c, &ValueUnion);
+        }
+    }
+
+    /*
+     * Check for required stuff.
+     */
+    if (szIsoPath[0] == '\0')
+        return errorSyntax("No ISO specified");
+
+    /*
+     * Do the job.
+     */
+    ComPtr<IUnattended> ptrUnattended;
+    CHECK_ERROR2_RET(hrc, a->virtualBox, CreateUnattendedInstaller(ptrUnattended.asOutParam()), RTEXITCODE_FAILURE);
+    CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(IsoPath)(Bstr(szIsoPath).raw()), RTEXITCODE_FAILURE);
+    CHECK_ERROR2_RET(hrc, ptrUnattended, DetectIsoOS(), RTEXITCODE_FAILURE);
+
+    /*
+     * Retrieve the results.
+     */
+    Bstr bstrDetectedOSTypeId;
+    CHECK_ERROR2_RET(hrc, ptrUnattended, COMGETTER(DetectedOSTypeId)(bstrDetectedOSTypeId.asOutParam()), RTEXITCODE_FAILURE);
+    Bstr bstrDetectedVersion;
+    CHECK_ERROR2_RET(hrc, ptrUnattended, COMGETTER(DetectedOSVersion)(bstrDetectedVersion.asOutParam()), RTEXITCODE_FAILURE);
+    Bstr bstrDetectedFlavor;
+    CHECK_ERROR2_RET(hrc, ptrUnattended, COMGETTER(DetectedOSFlavor)(bstrDetectedFlavor.asOutParam()), RTEXITCODE_FAILURE);
+    Bstr bstrDetectedHints;
+    CHECK_ERROR2_RET(hrc, ptrUnattended, COMGETTER(DetectedOSHints)(bstrDetectedHints.asOutParam()), RTEXITCODE_FAILURE);
+    if (fMachineReadable)
+        RTPrintf("OSTypeId=\"%ls\"\n"
+                 "OSVersion=\"%ls\"\n"
+                 "OSFlavor=\"%ls\"\n"
+                 "OSHints=\"%ls\"\n",
+                 bstrDetectedOSTypeId.raw(),
+                 bstrDetectedVersion.raw(),
+                 bstrDetectedFlavor.raw(),
+                 bstrDetectedHints.raw());
+    else
+    {
+        RTMsgInfo("Detected '%s' to be:\n", szIsoPath);
+        RTPrintf("    OS TypeId  = %ls\n"
+                 "    OS Version = %ls\n"
+                 "    OS Flavor  = %ls\n"
+                 "    OS Hints   = %ls\n",
+                 bstrDetectedOSTypeId.raw(),
+                 bstrDetectedVersion.raw(),
+                 bstrDetectedFlavor.raw(),
+                 bstrDetectedHints.raw());
+    }
+
+    return RTEXITCODE_SUCCESS;
+}
+
 RTEXITCODE handleUnattendedInstall(HandlerArg *a)
 {
@@ -1281,4 +1377,5 @@
     RTCList<RTCString>  arrPackageSelectionAdjustments;
     ComPtr<IMachine>    ptrMachine;
+    bool                fDryRun = false;
     const char         *pszSessionType = "headless";
 
@@ -1286,7 +1383,4 @@
      * Parse options.
      */
-    if (a->argc <= 1)
-        return errorSyntax(USAGE_UNATTENDEDINSTALL, "Missing VM name/UUID.");
-
     static const RTGETOPTDEF s_aOptions[] =
     {
@@ -1308,4 +1402,5 @@
         { "--hostname",                         'H', RTGETOPT_REQ_STRING },
         { "--package-selection-adjustment",     's', RTGETOPT_REQ_STRING },
+        { "--dry-run",                          'D', RTGETOPT_REQ_NOTHING },
         // advance options:
         { "--auxiliary-base-path",              'x', RTGETOPT_REQ_STRING },
@@ -1331,5 +1426,5 @@
             case VINF_GETOPT_NOT_OPTION:
                 if (ptrMachine.isNotNull())
-                    return errorSyntax(USAGE_UNATTENDEDINSTALL, "VM name/UUID given more than once!");
+                    return errorSyntax("VM name/UUID given more than once!");
                 CHECK_ERROR2_RET(hrc, a->virtualBox, FindMachine(Bstr(ValueUnion.psz).raw(), ptrMachine.asOutParam()), RTEXITCODE_FAILURE);
                 CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(Machine)(ptrMachine), RTEXITCODE_FAILURE);
@@ -1339,5 +1434,5 @@
                 vrc = RTPathAbs(ValueUnion.psz, szAbsPath, sizeof(szAbsPath));
                 if (RT_FAILURE(vrc))
-                    return errorSyntax(USAGE_UNATTENDEDINSTALL, "RTPathAbs failed on '%s': %Rrc", ValueUnion.psz, vrc);
+                    return errorSyntax("RTPathAbs failed on '%s': %Rrc", ValueUnion.psz, vrc);
                 CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(IsoPath)(Bstr(szAbsPath).raw()), RTEXITCODE_FAILURE);
                 break;
@@ -1368,5 +1463,5 @@
                 vrc = RTPathAbs(ValueUnion.psz, szAbsPath, sizeof(szAbsPath));
                 if (RT_FAILURE(vrc))
-                    return errorSyntax(USAGE_UNATTENDEDINSTALL, "RTPathAbs failed on '%s': %Rrc", ValueUnion.psz, vrc);
+                    return errorSyntax("RTPathAbs failed on '%s': %Rrc", ValueUnion.psz, vrc);
                 CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(AdditionsIsoPath)(Bstr(szAbsPath).raw()), RTEXITCODE_FAILURE);
                 break;
@@ -1381,5 +1476,5 @@
                 vrc = RTPathAbs(ValueUnion.psz, szAbsPath, sizeof(szAbsPath));
                 if (RT_FAILURE(vrc))
-                    return errorSyntax(USAGE_UNATTENDEDINSTALL, "RTPathAbs failed on '%s': %Rrc", ValueUnion.psz, vrc);
+                    return errorSyntax("RTPathAbs failed on '%s': %Rrc", ValueUnion.psz, vrc);
                 CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(ValidationKitIsoPath)(Bstr(szAbsPath).raw()), RTEXITCODE_FAILURE);
                 break;
@@ -1407,4 +1502,8 @@
             case 's':   // --package-selection-adjustment
                 arrPackageSelectionAdjustments.append(ValueUnion.psz);
+                break;
+
+            case 'D':
+                fDryRun = true;
                 break;
 
@@ -1412,5 +1511,5 @@
                 vrc = RTPathAbs(ValueUnion.psz, szAbsPath, sizeof(szAbsPath));
                 if (RT_FAILURE(vrc))
-                    return errorSyntax(USAGE_UNATTENDEDINSTALL, "RTPathAbs failed on '%s': %Rrc", ValueUnion.psz, vrc);
+                    return errorSyntax("RTPathAbs failed on '%s': %Rrc", ValueUnion.psz, vrc);
                 CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(AuxiliaryBasePath)(Bstr(szAbsPath).raw()), RTEXITCODE_FAILURE);
                 break;
@@ -1423,5 +1522,5 @@
                 vrc = RTPathAbs(ValueUnion.psz, szAbsPath, sizeof(szAbsPath));
                 if (RT_FAILURE(vrc))
-                    return errorSyntax(USAGE_UNATTENDEDINSTALL, "RTPathAbs failed on '%s': %Rrc", ValueUnion.psz, vrc);
+                    return errorSyntax("RTPathAbs failed on '%s': %Rrc", ValueUnion.psz, vrc);
                 CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(ScriptTemplatePath)(Bstr(szAbsPath).raw()), RTEXITCODE_FAILURE);
                 break;
@@ -1430,5 +1529,5 @@
                 vrc = RTPathAbs(ValueUnion.psz, szAbsPath, sizeof(szAbsPath));
                 if (RT_FAILURE(vrc))
-                    return errorSyntax(USAGE_UNATTENDEDINSTALL, "RTPathAbs failed on '%s': %Rrc", ValueUnion.psz, vrc);
+                    return errorSyntax("RTPathAbs failed on '%s': %Rrc", ValueUnion.psz, vrc);
                 CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(PostInstallScriptTemplatePath)(Bstr(szAbsPath).raw()), RTEXITCODE_FAILURE);
                 break;
@@ -1447,5 +1546,5 @@
 
             default:
-                return errorGetOpt(USAGE_UNATTENDEDINSTALL, c, &ValueUnion);
+                return errorGetOpt(c, &ValueUnion);
         }
     }
@@ -1455,5 +1554,5 @@
      */
     if (ptrMachine.isNull())
-        return errorSyntax(USAGE_UNATTENDEDINSTALL, "Missing VM name/UUID");
+        return errorSyntax("Missing VM name/UUID");
 
     /*
@@ -1504,6 +1603,9 @@
 
     CHECK_ERROR2_RET(hrc, ptrUnattended,Prepare(), RTEXITCODE_FAILURE);
-    CHECK_ERROR2_RET(hrc, ptrUnattended,ConstructMedia(), RTEXITCODE_FAILURE);
-    CHECK_ERROR2_RET(hrc, ptrUnattended,ReconfigureVM(), RTEXITCODE_FAILURE);
+    if (!fDryRun)
+    {
+        CHECK_ERROR2_RET(hrc, ptrUnattended, ConstructMedia(), RTEXITCODE_FAILURE);
+        CHECK_ERROR2_RET(hrc, ptrUnattended,ReconfigureVM(), RTEXITCODE_FAILURE);
+    }
 
     /*
@@ -1563,5 +1665,6 @@
      * Start the VM if requested.
      */
-    if (RTStrICmp(pszSessionType, "none") == 0)
+    if (   fDryRun
+        || RTStrICmp(pszSessionType, "none") == 0)
         hrc = S_OK;
     else
@@ -1617,2 +1720,27 @@
     return SUCCEEDED(hrc) ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE;
 }
+
+
+RTEXITCODE handleUnattended(HandlerArg *a)
+{
+    /*
+     * Sub-command switch.
+     */
+    if (a->argc < 1)
+        return errorNoSubcommand();
+
+    if (!strcmp(a->argv[0], "detect"))
+    {
+        setCurrentSubcommand(HELP_SCOPE_UNATTENDED_DETECT);
+        return handleUnattendedDetect(a);
+    }
+
+    if (!strcmp(a->argv[0], "install"))
+    {
+        setCurrentSubcommand(HELP_SCOPE_UNATTENDED_INSTALL);
+        return handleUnattendedInstall(a);
+    }
+
+    /* Consider some kind of create-vm-and-install-guest-os command. */
+    return errorUnknownSubcommand(a->argv[0]);
+}
