none
The capture-image option is unknown

    Question

  • Hi, 

    I'm trying to capture the C drive to a Image.

    OS: Windows 7 Home Premium
    Booted OS: WinPE 3

    Command: Dism /Capture-Image /ImageFile:R:\WinRE\restore.wim /CaptureDir:C:\ /Name:"Win 7 Home Premium Restore"

    But I get the following error:
    The capture-image option is unknown
    Although this is the EXACT way as described in the Documentation from Microsoft.

    What's going on here?

    BR, 
    Tom


    • Edited by Tokfan Wednesday, August 22, 2012 8:26 AM typo
    Wednesday, August 22, 2012 8:25 AM

Answers

All replies

  • I will have to go back and look but I don't think DISM captures the way your trying.  The tool you want to use is ImageX from the PE environment.

    If I recall correctly DISM /capture-image switch only works with a mounted wim image in DISM in a offline state.

    The link here shows what is usable to DISM via command switches on first position (ie DISM /*first position*).

    The link here shows how to create a windows PE iso that includes imagex for boot and capture of images from the PE environment.

    Next you will have to find out which drive is your OS disk.  If you installed windows 7 the default way your OS Disk will more then likely be drive letter D: due to the system partition created and hidden durning the installation.

    The command then would read similar to the following:

    imagex /capture D: R:\WinRe\restore.wim "Description" /verify

    Thanks

    Sean


    MCTS: Windows 7 MCITP: Windows 7 Enterprise Administration

    Wednesday, August 22, 2012 4:57 PM
  • Hi,


    I agree with Sean, you may need to use ImageX.


    More information about ImageX:

    Preparing an Image Using Sysprep and ImageX

    What Is Sysprep?

    Capture Images of Hard Disk Partitions by Using ImageX

    ImageX Technical Reference


    Hope this helps.


    Jeremy Wu

    TechNet Community Support

    Thursday, August 23, 2012 3:17 AM
    Moderator
  • I will have to go back and look but I don't think DISM captures the way your trying.  The tool you want to use is ImageX from the PE environment.

    If I recall correctly DISM /capture-image switch only works with a mounted wim image in DISM in a offline state.

    The link here shows what is usable to DISM via command switches on first position (ie DISM /*first position*).

    The link here shows how to create a windows PE iso that includes imagex for boot and capture of images from the PE environment.

    Next you will have to find out which drive is your OS disk.  If you installed windows 7 the default way your OS Disk will more then likely be drive letter D: due to the system partition created and hidden durning the installation.

    The command then would read similar to the following:

    imagex /capture D: R:\WinRe\restore.wim "Description" /verify

    Thanks

    Sean


    MCTS: Windows 7 MCITP: Windows 7 Enterprise Administration

    Hi, 

    Alright, That's what I thought. Wasn't ImageX included in the previous verison of WinPE? I've been doing this the old way for a couple of years ago and there never was any problems with it, Even if it was booted with a CD.

    Many thanks for the answer, and the links. I think this will solve the whole issue. I just didn't know if ImageX where still alive or even usable in the newer versions of PE.
    I'll get back with results in asap. 

    Once again, Thanks

    BR,  Tom

    Thursday, August 23, 2012 7:43 AM
  • Hi Tom,


    Just check if there is any update on the situation.


    Regards.


    Jeremy Wu

    TechNet Community Support

    Monday, August 27, 2012 5:40 AM
    Moderator
  • The error "The capture-image option is unknown" may be due to you not using a absolute path to DISM.EXE in your batch file. DISM is the replacement for IMAGEX (I use it all of the time). It will capture and apply an image along with all of the other IMAGEX functionality. Since it is already installed in Windows 8 and on the Install media, you can run it and image a folder or your entire drive directly from the Windows 8 install media without having to create your own WinPE CD (from the Windows 8 install media:   REPAIR - TROUBLESHOOTING - ADVANCED - COMMAND PROMPT). Below is the batch file I use. You just need it on a logical drive which isn't in the folder path you are capturing, preferably a different logical drive than the target. It is pretty generic and it will prompt you for your selections. It will format your target drive during an APPLY if you select yes. It names the WIM image based on the current date and time. DISM needs a scratch directory to write to and it is created in the folder you save your image to. Use at your own risk (I am not entirely sure the formatting in this thread left things alone, but it does appear to have). Let me know if you have any questions.

    HERE IS AN EXAMPLE OF THE INPUT YOU WILL BE ASKED FOR


        ------- THIS SCRIPT IS FOR CAPTURING AND APPLYING DISM IMAGES -------


    Enter the imaging action you want to execute
    (Capture, Apply). . . . . . . . . capture

    Enter the target location (drive\directory) where you want to CAPTURE your
    backup image. . . . . . . . . . . d:\images\a780lw800

    Enter the path (drive\directory) you want to backup (CAPTURE)
    . . . . . . . . . . . . . . . . . c:\

    HERE IS THE VERIFICATION PROMPT


    Verify the below selections prior to beginning . . .

    IMAGING ACTION . . . . . . . . . . . . . capture
    LOCATION WHERE IMAGE WILL BE SAVED . . . d:\images\a780lw800
    DRIVE\DIRECTORY TO BACKUP (CAPTURE). . . c:\
    IMAGE NAME OF BACKUP (CAPTURE) . . . . . 20121122_0819.wim

    Does the above selections appear correct? (yes, no)

    @echo off
    ::
    ::
    ::    This batch file was created by Curtis Tittle Sr.
    ::
    ::    Last updated on 11-22-2012 at 6:20am
    ::
    ::
    cls
    echo.
    echo     ------- THIS SCRIPT IS FOR CAPTURING AND APPLYING DISM IMAGES -------
    echo.
    echo.


    set today=
    set now=
    set now2kf4=
    set now2kl1=
    set newnow=
    set newnowf2=
    set newnowl2=
    set newnow=
    set now1=
    set now12=
    set now2=
    set now3=
    set mltryhour=13
    set mltryhour=14
    set mltryhour=15
    set mltryhour=16
    set mltryhour=17
    set mltryhour=18
    set mltryhour=19
    set mltryhour=20
    set mltryhour=21
    set mltryhour=22
    set mltryhour=23
    set mltryhour=12
    set mltryhour=
    set mltrytime=
    set currentdaytime=

     

    FOR /F "tokens=1-4 delims=/ " %%I IN ('DATE /t') DO SET today=%%L%%J%%K
    FOR /F "tokens=1-4 delims=:-. " %%G IN ('time /t') DO SET now=%%G%%H%%I
    ::
    ::  Last 1 characters of the time
    set now2kck=%now:~-1%
    if /I "%now2kck%"=="a" goto w2k
    if /I "%now2kck%"=="p" goto w2k
    goto wxp

    :w2k
    ::  First 4 characters of the time
    set now2kf4=%now:~0,4%
    ::  Last 1 characters of the time
    set now2kl1=%now2kf4:~-1%
    ::
    if /I "%now2kl1%"=="a" goto add0
    if /I "%now2kl1%"=="p" goto add0
    goto noadd0

    :add0
    set newnow=0%now:~0,3%
    set newnowf2=%newnow:~0,2%
    set newnowl2=%newnow:~-2%
    set newnow=%newnowf2%:%newnowl2% %now2kck%m
    set now=%newnowf2%%newnowl2%%now2kck%m
    goto noww2k

    :noadd0
    set newnow=%now:~0,4%
    set newnowf2=%newnow:~0,2%
    set newnowl2=%newnow:~-2%
    set newnow=%newnowf2%:%newnowl2% %now2kck%m
    set now=%newnowf2%%newnowl2%%now2kck%m
    goto noww2k

    :wxp
    FOR /F "tokens=1-4 delims=:-. " %%G IN ('time /t') DO SET now=%%G%%H%%I
    :noww2k
    FOR /F "tokens=1-4 delims=/ " %%I IN ('DATE /t') DO SET today=%%L%%J%%K
    ::
    ::  First 2 characters of the time
    set now1=%now:~0,2%
    ::  First 4 characters of the time
    set now12=%now:~0,4%
    ::  Middle 2 characters of the time
    set now2=%now12:~-2%
    ::  Last 2 characters of the time
    set now3=%now:~-2%
    ::
    if /I not "%now3%"=="pm" goto skpmltryhour
    ::  Setting the military hour
    if "%now1%"=="01" set mltryhour=13
    if "%now1%"=="02" set mltryhour=14
    if "%now1%"=="03" set mltryhour=15
    if "%now1%"=="04" set mltryhour=16
    if "%now1%"=="05" set mltryhour=17
    if "%now1%"=="06" set mltryhour=18
    if "%now1%"=="07" set mltryhour=19
    if "%now1%"=="08" set mltryhour=20
    if "%now1%"=="09" set mltryhour=21
    if "%now1%"=="10" set mltryhour=22
    if "%now1%"=="11" set mltryhour=23
    if "%now1%"=="12" set mltryhour=12
    goto setmltrytime

    :skpmltryhour
    ::  Setting the military hour
    set mltryhour=%now1%
    if "%now1%"=="12" set mltryhour=00
    goto setmltrytime

    :setmltrytime
    ::  Setting the military time
    set mltrytime=%mltryhour%%now2%
    goto setcurrentdaytime

    :setcurrentdaytime
    ::  Setting the current day with the military time
    set currentdaytime=%today%_%mltrytime%

     

    set dismaction=
    set scrtchdir=
    ::
    set captureimgloc=
    set capturepath=
    set vercptrinput=
    ::
    set sourcepath=
    set sourcewim=
    set applypath=
    set frmtdrv=
    set verapplinput=

     

    echo=Enter the imaging action you want to execute
    SET /P dismaction=(Capture, Apply). . . . . . . . .
    if /i "%dismaction%"=="capture" goto capture
    if /i "%dismaction%"=="apply" goto apply
    if /i "%dismaction%"=="" echo. & echo You must enter an imaging action & goto end
    echo. & echo You entered an invalid choice. You must enter Capture or Apply & goto end
    goto %dismaction%

     

    :capture
    echo.
    echo=Enter the target location (drive\directory) where you want to CAPTURE your
    SET /P captureimgloc=backup image. . . . . . . . . . .
    if /i "%captureimgloc%"=="" echo. & echo You must enter a target location where you want to CAPTURE your backup image & goto end
    if not exist %captureimgloc% echo. & echo You entered an invalid target location & goto end
    ::
    ::  First 2 characters of SCRATCHDIR
    set scrtchdir=%captureimgloc:~0,2%
    if not exist %scrtchdir%\images\scratchdir md %scrtchdir%\images\scratchdir
    ::
    echo.
    echo=Enter the path (drive\directory) you want to backup (CAPTURE)
    SET /P capturepath=. . . . . . . . . . . . . . . . .
    if /i "%capturepath%"=="" echo. & echo You must enter a drive\directory to backup (CAPTURE) & goto end
    if not exist %capturepath% echo. & echo You entered an invalid drive\directory to backup (CAPTURE) & goto end
    ::
    cls
    echo.
    ::
    echo Verify the below selections prior to beginning . . .
    echo.
    echo IMAGING ACTION . . . . . . . . . . . . . %dismaction%
    echo LOCATION WHERE IMAGE WILL BE SAVED . . . %captureimgloc%
    echo DRIVE\DIRECTORY TO BACKUP (CAPTURE). . . %capturepath%
    echo IMAGE NAME OF BACKUP (CAPTURE) . . . . . %currentdaytime%.wim
    echo.
    SET /P vercptrinput=Does the above selections appear correct? (yes, no)
    if /i "%vercptrinput%"=="" echo. & echo You must enter yes or no & goto end
    if /i "%vercptrinput%"=="yes" goto startcapture
    if /i "%vercptrinput%"=="no" goto end
    goto end
    ::
    :startcapture
    @echo on
    %systemroot%\system32\Dism.exe /capture-image /ImageFile:%captureimgloc%\%currentdaytime%.wim /CaptureDir:%capturepath% /LogLevel:3 /LogPath:%captureimgloc%\%currentdaytime%.log /Compress:max /CheckIntegrity /Verify /ScratchDir:%scrtchdir%\images\scratchdir /Name:"DISM WIM image of %capturepath%"
    @echo off
    goto end

     

    :apply
    echo.
    echo=Enter the path to the drive\directory where the image is you want to APPLY
    SET /P sourcepath=. . . . . . . . . . . . . . . . .
    if /i "%sourcepath%"=="" echo. & echo You must enter a path where there is a valid WIM image file & goto end
    if not exist %sourcepath%\*.wim echo. & echo You entered an invalid path & goto end
    echo.
    dir %sourcepath%\*.wim /b /on
    echo.
    echo Enter a WIM image filename from the above available captured images to APPLY
    SET /P sourcewim=(exclude the WIM file ext.) . . .
    if /i "%sourcewim%"=="" echo. & echo You must enter a WIM image filename to APPLY & goto end
    if not exist %sourcepath%\%sourcewim%.wim echo. & echo You entered an invalid WIM image file [%sourcewim%.wim] & goto end
    ::
    ::  First 2 characters of SCRATCHDIR
    set scrtchdir=%sourcepath:~0,2%
    if not exist %scrtchdir%\images\scratchdir md %scrtchdir%\images\scratchdir
    ::
    echo.
    echo Enter the target restore path (drive\directory) where you want to APPLY
    SET /P applypath=the image . . . . . . . . . . . .
    if /i "%applypath%"=="" echo. & echo You must enter a path where you want to APPLY the image & goto end
    if not exist %applypath% echo. & echo You entered an invalid path to APPLY the image & goto end
    ::
    echo.
    echo Do you want to FORMAT the target drive where you will APPLY the image?
    SET /P frmtdrv=(yes, no) . . . . . . . . . . . .
    if /i "%frmtdrv%"=="" echo. & echo You must enter yes or no & goto end
    if /i "%frmtdrv%"=="yes" goto applyverify
    if /i "%frmtdrv%"=="no" goto applyverify
    ::
    :applyverify
    cls
    echo.
    ::
    echo Verify the below selections prior to beginning . . .
    echo.
    echo IMAGING ACTION . . . . . . . . . . . . . %dismaction%
    echo SOURCE IMAGE LOCATION. . . . . . . . . . %sourcepath%
    echo IMAGE FILENAME . . . . . . . . . . . . . %sourcewim%.wim
    echo IMAGE RESTORE PATH . . . . . . . . . . . %applypath%
    echo FORMATTING TARGET DRIVE. . . . . . . . . %frmtdrv%
    echo.
    set /p verapplinput=Does the above selections appear correct? (yes, no)
    if /i "%verapplinput%"=="" echo. & echo You must enter yes or no & goto end
    if /i "%verapplinput%"=="no" goto end
    if /i "%verapplinput%"=="yes" echo. & goto formatdrive
    goto end
    ::
    :formatdrive
    if /i "%frmtdrv%"=="no" goto startapply
    ::  First 2 characters of APPLYPATH
    set frmtpath=%applypath:~0,2%
    echo.
    if not exist %frmtpath%\bootmgr echo The folder selected is not a SYSTEM folder & goto end
    echo The SYSTEM drive has been verified for FORMATTING & echo.
    %systemroot%\system32\format.com %frmtpath% /fs:ntfs /q /v:SYSTEM /x /y
    :startapply
    @echo on
    %systemroot%\system32\Dism.exe /apply-image /imagefile:%sourcepath%\%sourcewim%.wim /index:1 /ApplyDir:%applypath% /LogLevel:3 /LogPath:%sourcepath%\%sourcewim%.log /ScratchDir:%scrtchdir%\images\scratchdir
    @echo off
    goto end

     

    :end

    Thursday, November 22, 2012 2:27 PM