Scratch directory commands in windows RE for dism restorehealth that do not display errors

Docs 15,146 Reputation points
2021-05-08T05:26:02.487+00:00

How come these commands displayed errors and what commands should work without errors?

Error: 87
Error: 1639

X:\windows\system32>diskpart

Microsoft DiskPart version 10.0.19041.1

Copyright (C) Microsoft Corporation.
On computer: MININT-P6MKHHP

DISKPART> lis dis

Disk ### Status Size Free Dyn Gpt


Disk 0 Online 698 GB 0 B
Disk 1 Online 58 GB 26 GB

DISKPART> sel dis 0

Disk 0 is now the selected disk.

DISKPART> lis vol

Volume ### Ltr Label Fs Type Size Status Info


Volume 0 H DVD-ROM 0 B No Media
Volume 1 C System Rese NTFS Partition 499 MB Healthy
Volume 2 E Windows NTFS Partition 689 GB Healthy
Volume 3 F HP_TOOLS FAT32 Partition 2056 MB Healthy
Volume 4 D ESD-USB FAT32 Removable 32 GB Healthy
Volume 5 G Recovery NTFS Partition 7148 MB Healthy Hidden

DISKPART> exit

Leaving DiskPart...

X:\windows\system32>sfc /scannow /offbootdir=c:\ /offwindir=e:\windows

Beginning system scan. This process will take some time.

Windows Resource Protection did not find any integrity violations.

X:\windows\system32>dism /image:e:\ /cleanup-image /restorehealth

Deployment Image Servicing and Management tool
Version: 10.0.19041.1

Image Version: 10.0.19042.844

The scratch directory size might be insufficient to perform this operation. This can cause unexpected behavior.
Use the /ScratchDir option to point to a folder with sufficient scratch space. The recommended size is at least 1024 MB.

[==========================100.0%==========================]
Error: 0x800f081f

The source files could not be found.
Use the "Source" option to specify the location of the files that are required to restore the feature. For more information on specifying a source location, see https://go.microsoft.com/fwlink/?LinkId=243077.

The DISM log file can be found at X:\windows\Logs\DISM\dism.log

X:\windows\system32>md e:\scratchdir

X:\windows\system32>dism /image:e:\windows /scratchdir /cleanup-image /restorehealth /source:esd:D:\sources\install.esd:6 /limitaccess

Error: 87

The /scratchdir option is missing a required argument.
For more information, refer to the help by running DISM /scratchdir /?.

The DISM log file can be found at X:\windows\Logs\DISM\dism.log

X:\windows\system32>dism /scratchdir /?

Deployment Image Servicing and Management tool
Version: 10.0.19041.1

/ScratchDir:<path_to_directory>

Specifies a temporary directory to be used for extracting files for
servicing. The directory must exist.

If not set, the temporary directory will be used.

Example:
  DISM.exe /Image:C:\test\offline /scratchdir:D:\Scratch

X:\windows\system32>dism /image:e:\test\offline /scratchdir:e:\scratch

Deployment Image Servicing and Management tool
Version: 10.0.19041.1

Error: 1639

The command-line is missing a required servicing command.
For more information, refer to the help by running DISM.exe /Image=<path_to_offline_image> /? where <path_to_the_offline_image> is the full path to an offline Windows image.

The DISM log file can be found at X:\windows\Logs\DISM\dism.log

X:\Sources>dism /image:e:\ /scratchdir: e:\windows\temp /cleanup-image /restorehealth

Error: 87

The /scratchdir: option is missing a required argument.
For more information, refer to the help for the /scratchdir: option.

X:\Sources>dism /image:e: /cleanup-image /restorehealth

Deployment Image Servicing and Management tool
Version: 10.0.19041.572

Image Version: 10.0.19042.844

The scratch directory size might be insufficient to perform this operation. This can cause unexpected behavior.
Use the /ScratchDir option to point to a folder with sufficient scratch space. The recommended size is at least 1024 MB.

[===========================84.9%================= ]
[===========================85.2%================= ]
[===========================85.7%================= ]
[===========================86.1%================= ]
[===========================86.6%================== ]
[===========================87.0%================== ]
[===========================87.5%================== ]
[===========================87.9%================== ]
[===========================88.4%=================== ]
[===========================88.8%=================== ]
[===========================89.3%=================== ]
[===========================89.7%==================== ]
[===========================90.2%==================== ]
[===========================90.6%==================== ]
[===========================91.1%==================== ]
[===========================91.5%===================== ]
[===========================92.0%===================== ]
[==========================100.0%==========================]
Error: 0x800f081f

The source files could not be found.
Use the "Source" option to specify the location of the files that are required to restore the feature. For more information on specifying a source location, see https://go.microsoft.com/fwlink/?LinkId=243077.

The computer can boot to Windows RE > command prompt
or
The computer can boot to a winndows 10 iso > Windows RE > command prompt

Please provide commands to use scratch that do not display errors when running dism restorehealth.

For the iso: esd:6

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,701 questions
{count} votes

4 answers

Sort by: Most helpful
  1. Docs 15,146 Reputation points
    2021-05-10T04:28:20.17+00:00

    This is the result to the earlier reply by cheong00

    Error: 267

    Microsoft Windows [Version 10.0.19042.964]
    (c) Microsoft Corporation. All rights reserved.

    C:\WINDOWS\system32>dism /image:e:\windows /scratchdir:e:\scratchdir /cleanup-image /restorehealth /source:esd:D:\sources\install.esd:6 /limitaccess

    Deployment Image Servicing and Management tool
    Version: 10.0.19041.844

    Error: 267

    An error occurred while accessing the temporary directory.
    Ensure that the path to the directory exists and that you have Read/Write permissions on the folder. For more information, refer to the help by running DISM.exe /ScratchDir /?.

    C:\WINDOWS\system32>


  2. Miles 1,251 Reputation points
    2021-05-10T09:24:19.723+00:00

    Hi

    For deep research on DISM , you could open a request ticket with Microsoft support. https://support.serviceshub.microsoft.com/supportforbusiness

    Best Regards

    0 comments No comments

  3. Docs 15,146 Reputation points
    2021-05-11T02:29:56.797+00:00

    There are many end users that develop boot problems related to windows updates or integrity violations detected by using scannow.

    Troubleshooting can be performed in Windows Recovery Environment (RE).

    Two DISM commands that can be run in Windows RE are:

    Restorehealth

    Revertpendingactions

    Each of these may require scratch.

    Does anybody know how to use scratch in Windows RE?

    dism /image:D:\ /cleanup-image /revertpendingactions
    dism /image:D:\ /cleanup-image /restorehealth

    The scratch directory size might be insufficient to perform this operation.
    This can cause unexpected behavior.
    Use the /ScratchDir option to point to a folder with sufficient scratch space.
    The recommended size is at least 1024 MB.

    @Miles
    These basic questions on using scratch should not require a business ticket as they are to help non-business end users.

    How do you run dism commands in windows RE so that there are no error messages / codes?

    Error: 87
    Error: 1639
    Error: 267


  4. Docs 15,146 Reputation points
    2021-05-13T07:33:17.193+00:00

    So for this thread I'm not seeking pay support.

    On this website I provide free support.

    This was my first question.

    I'm seeking free support.

    If somebody can find the answer(s) for Windows RE they may be useful in many threads.

    For example: How to run DISM commands in windows RE so that there are no scratch error messages and / or codes.

    For each:

    restorehealth
    revertpendingactions