Меню Рубрики

Windows deployment image servicing and management dism

Deployment Image Servicing and Management (DISM) Best Practices

This section describes some best practices related to servicing a Windows image. We recommend that you implement these practices wherever possible.

Elevate Permissions for Command-Line Tools

Many deployment command-line tools, including Deployment Image Servicing and Management (DISM), require elevated permissions.

Make sure that you have elevated permissions. Click Start, and type deployment. Right-click Deployment and Imaging Tools Environment and then select Run as administrator.

This must be done even if you are logged on as an administrator.

Disable Antivirus Tools

Some DISM commands may be blocked by antivirus or antimalware tools. Before servicing an image, disable antivirus or antimalware tools on the technician computer.

Servicing an Image

The best way to service a Windows image is offline with the DISM tool. DISM can be used to install, uninstall, configure, and update drivers, features, and packages in Windows images and Windows Preinstallation Environment (WinPE) images without booting the image. For more information, see DISM — Deployment Image Servicing and Management Technical Reference for Windows.

You can use the /Commit-Image option at any point during servicing to save the changes that you have made so far. You can recover a corrupted image more easily with the /Cleanup-Image /RestoreHealth option if you have committed your changes often.

You can mount and modify multiple images on a single computer. However, performance may slow down on some functions, such as /Unmount-Image, depending on the memory available on the computer. As a best practice, you should not mount more than 20 images at the same time.

NoteВ В If you have split a .wim file into smaller files for spanning across multiple media, you cannot mount the image for servicing.

Changing International Settings

To change the international settings in WindowsВ 10, WindowsВ 8.1, WindowsВ 8, Windows ServerВ 2016 Technical Preview, Windows ServerВ 2012В R2, Windows ServerВ 2012, WindowsВ 7, and Windows ServerВ 2008В R2 images, you must use DISM. For more information, see DISM Languages and International Servicing Command-Line Options.

Use Log Files

DISM will log verbose information to %WINDIR%\Logs\Dism\Dism.log by default. You can also specify a name and location of your choice for the log file, and set the /loglevel parameters so that only the information you are interested in is logged. When an error occurs, the console will display the error code, error message, and the location of the log file.

ImportantВ В If you specify a log path on a network share from a computer that is not joined to a domain, use net-use with domain credentials to set access permissions before you set the log path for the DISM log.

The log file will automatically be archived. The archived log file will be saved with .bak appended to the file name, and a new log file will be generated. Each time the log file is archived, the .bak file will be overwritten.

The log file gives you the history of the operations that have been performed, which can help you troubleshoot problems.

Package Locations

Do not put a package that you intend to install directly at the root of a partition on a Windows installation.

Storing Files on a Network Share

Although DISM supports network paths for images and packages, most operations will perform faster on files that are copied to the local hard-drive.

Servicing a Windows Image from WinPE

You can service Windows images from WinPE. However, you must consider certain factors while planning your servicing strategy. Review the following requirements for servicing an image from WinPE.

Booting WinPE from a Hard Drive

For better performance, you can allocate additional memory when you boot WinPE from a hard disk drive. You can also create temporary folders to store update files to accommodate large updates.

Add Page-File Support to Your WinPE Image

Make sure you have sufficient memory to load and run your custom WinPE image. In addition to the image size, you should have at least 256В MB of available working memory. If you have limited memory, define a page file (Pagefile.sys) to improve memory management. For more information on implementing a page file, see Wpeutil Command-Line Options.

Create a Temporary Directory in Which to Store Update Files

You should use the /ScratchDir option with DISM to create a temporary directory on a different drive when you create or service a Windows image. A temporary directory is used for many DISM operations including capturing an image, installing language packs, installing updates, or installing or removing Windows features in a Windows image. Some files are expanded to this temporary directory before they are applied to a Windows image.

There must be sufficient space in the partition to accommodate large updates. The specific size of the free space that is required depends on the size of the updates that you intend to install. When adding a language pack, the scratch directory must have at least 1 GB of space for temporary files.

If you do not set a temporary directory path using the /ScratchDir option, WinPE creates a 32-MB temporary directory by default. You can allocate additional temporary storage to this default location using the DISM /Set-ScratchSpace option. Valid sizes include 32, 64, 128, 256, and 512 MB. This feature is available only offline and you cannot adjust this setting while a WinPE session is running. As a best practice, you should use the /ScratchDir option to instead specify a directory on another partition that has sufficient space to support any image management and servicing operations you perform.

After installation is complete, the contents of this directory are no longer needed and can be deleted. For more information, see DISM Image Management Command-Line Options.

Booting WinPE from a CD-ROM/DVD

Servicing a Windows image requires additional temporary storage space. For WinPE RAM disks, you might need additional RAM. In addition to the RAM requirements of your WinPE image, additional RAM is required to process updates. The amount of RAM that is required depends on the size of the updates that you intend to apply. Ensure that your computer has sufficient RAM.

Scan for Corruption and Verify the Integrity of System Files

Before you deliver a computer to an end user, you should verify the integrity of Windows system files. You can use the /Cleanup-Image option to identify file corruption and perform repair operations on the image. For more information about the /Cleanup-Image option in DISM, see DISM Operating System Package Servicing Command-Line Options.

You can also use System File Checker (Sfc.exe) on an online or offline reference image. System File Checker is released with all versions of Windows.System File Checker requires elevated permissions, and you must be an Administrator to run it. It scans all protected files to verify the file versions. To verify only the integrity of the Windows system files, run the sfc.exe /verifyonly option. For complete command-line syntax, at an elevated command prompt, type sfc.exe /?.

Running Sfc.exe can take a significant amount of time. The expected result is that there are no system integrity violations. However, if there are problems with Windows system files, you should investigate the issues. We do not recommend that you use the Sfc.exe scan options to automatically fix Windows system files.

Improving Security for Windows Images

Your Windows images contain custom configuration data, custom applications, and other intellectual property. There are several ways to improve the security of your Windows images, both online and offline.

Restrict access to Windows images. Depending on your environment, you can edit the access control lists (ACLs) or permissions on a file. Only approved accounts can have access to Windows images.

Update your Windows images with the latest fixes and software updates. There are many ways you can service a Windows image. After servicing your Windows image, test the validity and stability of the computer.

During Windows installation, configure the computer to automatically download and install Windows updates. This extends installation time, but ensures that the Windows image that you are installing contains the latest updates. For more information, see the DynamicUpdate setting in the Microsoft-Windows-Setup component in the Unattended Windows Setup Reference.

Источник

DISM: проверка и восстановление системных компонентов образа Windows 10

Для проверки целостности системных файлов и восстановления поврежденных файлов (библиотек) компонентов в Windows (Windows Server) можно использовать команды SFC и DISM (Deployment Image Servicing and Management). Данные утилиты могут быть крайне полезными, если операционная система Windows работает нестабильно, появляются ошибки при запуске стандартных приложений или служб, после вирусного заражения и т.д.

Утилита DISM включена в состав Windows, начиная с Vista и может быть использована во всех поддерживаемых версиях начиная с Windows 7/Windows Server 2008 R2 (есть ограничения) заканчивая последними билдами Windows 10 / Windows Server 2019. В этой статье мы рассмотрим, как использовать утилиты DISM и SFC для проверки и восстановления целостности образа и системных файлов Windows 10.

SFC /scannow: Проверка и восстановление системных файлов Windows

Утилиту DISM для восстановления Windows обычно рекомендуется использовать после утилиты проверки целостности системных файлов SFC (System File Checker). Команда sfc /scannow сканирует защищенные системные файлы Windows, и, если они отсутствуют или повреждены, попробует восстановить их оригинальные копии из хранилища системных компонентов Windows (каталог C:\Windows\WinSxS).

Если команда sfc /scannow возвращает ошибку “ Программа защиты ресурсов Windows обнаружила повреждённые файлы, но не может восстановить некоторые из них / Windows Resource Protection found corrupt files but was unable to fix some of them ”, скорее всего утилита не смогла получить необходимые файла из хранилища компонентов (образа) Windows.

В этом случае вам нужно попробовать восстановить хранилище компонентов (ваш образ Windows) с помощью DISM.

После восстановления образа вы можете повторно использовать утилиту SFC для восстановления системных файлов.

DISM /RestoreHealth: Восстановление хранилища компонентов образа Windows

Для сканирования образа Windows на наличие ошибок и их исправления используется параметр DISM /Cleanup-image . Рассмотренные ниже команды выполняются в командной строке, запущенной с правами администратора.

Чтобы проверить наличие признака повреждения хранилища компонентов образа Windows (флага CBS) , который выставил один из системных процессов, выполните следующую команду (не применимо к Windows 7/Server 2008R2):

DISM /Online /Cleanup-Image /CheckHealth

При запуске этой команды не выполняется сканирование хранилища, проверяются лишь записанные ранее значения и события в журнале Windows. Изменения не вносятся. Команда проверит, не помечен ли образ как поврежденный и возможно ли устранить данное повреждение.

В этом примере команда вернула, что с образом все хорошо:

No component store corruption detected.
The operation completed successfully.

DISM /Online /Cleanup-Image /ScanHealth – выполнить полное сканирование хранилища компонентов на наличие повреждений в системных образа Windows (выполняется довольно долго от 10 до 30 минут).

Если команда /ScanHealth возвращает ошибки:

  • Хранилище компонентов подлежит восстановлению (The component sore is repairable);
  • Ошибка: 1726. Сбой при удалённом вызове процедуры;
  • Ошибка: 1910. Не найден указанный источник экспорта объекта.

Это однозначно говорит о том, что ваш образ Windows 10 поврежден и его нужно восстановить.

Чтобы исправить ошибки, автоматически скачать и заменить файлы повреждённых или отсутствующих компонентов эталонными версиями файлов (библиотек) из центра обновлений Windows (на компьютере должен быть доступ в Интернет), выполните:

DISM /Online /Cleanup-Image /RestoreHealth

Процесс сканирования и восстановления компонентов может быть довольно длительным (30 минут или более).

Если восстановление выполнится успешно, появится сообщение:

Восстановление выполнено успешно. Операция успешно завершена.
The restore operation completed successfully. The operation completed successfully.

Если на компьютере (сервере) отсутствует доступ в Интернет или отключена служба Windows Update, то при восстановлении хранилища компонентов появляются ошибки вида:

  • 0x800f0906 — Не удалось скачать исходные файлы. Укажите расположение файлов, необходимых для восстановления компонента, с помощью параметра Источник (0x800f0906 — The source files could not be downloaded. Use the source option to specify the location of the files that are required to restore the feature);
  • Ошибка: 0x800f0950 — Сбой DISM. Операция не выполнена (0x800f0950 — DISM failed. No operation was performed);
  • Ошибка: 0x800F081F. Не удалось найти исходные файлы. Укажите расположение файлов, необходимых для восстановления компонента, с помощью параметра Источник (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).

Вы можете указать WIM или ESD файл с оригинальным установочным образом Windows, который нужно использовать в качестве источника для восстановления файлов компонентов системы. Предположим, вы смонтировали установочный ISO образ Windows 10 в виртуальный привод E:. Для восстановления хранилища компонентов из образа используйте одну из команд:

DISM /online /cleanup-image /restorehealth /source:E:\sources\install.wim
Или:
DISM /online /cleanup-image /restorehealth /source:E:\sources\install.esd

Чтобы запретить использовать центр обновлений Windows в Интернете, и выполнять сканирование и восстановление образа Windows только из локального WIM/ESD файла:

DISM /online /cleanup-image /restorehealth /source:E:\sources\install.wim /limitaccess
Или:
DISM /online /cleanup-image /restorehealth /source:E:\sources\install.esd /limitaccess

dism /online /cleanup-image /restorehealth /limitaccess

Журнал сканирования и восстановления системных файлов утилиты DISM можно найти здесь: C:\Windows\Logs\CBS.log .

После восстановления хранилища компонентов вы можете запустить утилиту проверки системных файлов sfc /scannow . Скорее всего она успешно восстановит поврежденные файлы (Программа защиты ресурсов Windows обнаружила поврежденные файлы и успешно их восстановила).

Восстановление поврежденного хранилища компонентов Windows 10/Server 2016 с помощью PowerShell

В версии PowerShell в Windows 10 и Windows Server 2016/2019 есть аналоги рассмотренных выше команд DISM. Для сканирования хранилища компонентов и поиска повреждений в образе выполните:

Repair-WindowsImage -Online –ScanHealth

Если ошибок в хранилище компонентов не обнаружено, появится сообщение:

ImageHealth State: Healthy

Для запуска восстановления системных компонентов и файлов наберите:

Repair-WindowsImage -Online -RestoreHealth

Repair-WindowsImage -Online -RestoreHealth -Source E:\sources\install.wim:1

Где, 1 – индекс используемой у вас редакции Windows из WIM или ESD файла (список редакций Windows в WIM файле можно вывести так: Get-WindowsImage -ImagePath «E:\sources\install.wim» ).

Восстановление хранилища компонентов оффлайн если Windows не загружается

Если Windows не загружается корректно, вы можете выполнить проверку и исправление системных файлов в оффлайн режиме.

  1. Для этого загрузитесь с установочного (загрузочного диска) и на экране начала установки нажмите Shift + F10
  2. Чтобы разобраться с буквами дисков, назначенных в среде WinPE, выполните команду diskpart -> list vol (в моем примере диску, на котором установлена Windows присвоена буква C:\, эту букву я буду использовать в следующих командах);
  3. Проверим системные файлы и исправим поврежденные файлы командой: sfc /scannow /offbootdir=C:\ /offwindir=C:\Windows
  4. Для исправления хранилища компонентов используйте следующую команду (в качестве источника для восстановления компонентов мы используем WIM файл с установочным образом Windows 10, с которого мы загрузили компьютер):
    Dism /image:C:\ /Cleanup-Image /RestoreHealth /Source:D:\sources\install.wim
  5. Если на целевом диске недостаточно места, то для извлечения временных файлов нам понадобится отдельный диск достаточного размера, например F:\, на котором нужно создать пустой каталог: mkdir f:\scratch и запустить восстановление хранилища компонентов командой:
    Dism /image:C:\ /Cleanup-Image /RestoreHealth /Source:D:\sources\install.wim /ScratchDir:F:\scratch

Источник

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *

  • Windows defender что это за программа и нужна ли она если есть антивирус
  • Windows defender не включается защита в реальном времени
  • Windows defender user interface как отключить windows 10
  • Windows defender offline как отключить при запуске компьютера
  • Windows defender notification icon что это за программа и нужна ли она