Share via


[DaRT_8] リカバリ ・ イメージを作成する PowerShell スクリプトを使用する方法

適用対象: Diagnostics and Recovery Toolset 8.0

重要

この記事は機械翻訳されています。 機械翻訳についての「免責事項」をお読みください。この記事の英語版を参照するには、ここをクリックしてください。

PowerShell スクリプトを使用して、DaRT のリカバリ ・ イメージを作成するのには

作成できます、 Microsoft Diagnostics and Recovery Toolset (DaRT) 8.0ではなく、PowerShell スクリプトを使用して、リカバリ ・ イメージの DaRT 8.0イメージの回復ウィザード。次のスクリプトの例を参照してください。

This script was auto generated by the Microsoft DaRT Recovery Image Wizard.
###
This script uses the DISM and DaRT PowerShell commands to create a bootable DaRT image.
###Both a WIM and ISO file are produced.
###
### Examples of how to burn/copy the DaRT ISO to DVD/USB are available at the end of this script.
###

$ErrorActionPreference = "Stop";
### This variable tells PowerShell to stop if an error occurs.

###
### Import the modules necessary for DaRT Image creation.
###

Import-Module "Dism"
Import-Module "Microsoft.Dart"

###
### Specifies where the Windows 8 media is located and where the ISO and WIM files will be saved.
### These can be changed as necessary.
###

$Win8MediaPath = "D:\";
### This is the path of the Windows 8 media.
$DestinationWimPath = "C:\Users\Administrator\Desktop\DaRT8\x64\boot.wim";
### Specify where the WIM file will be saved.
$DestinationIsoPath = "C:\Users\Administrator\Desktop\DaRT8\x64\DaRT8.iso";
### Specify where the ISO will be saved.

###
### These variables are used to specify temporary and output directories based on the paths above.
###

$WimParentPath = (Split-Path -Path "$destinationWimPath" -Parent);
### Specify the directory where the DaRT WIM file will be saved.
$IsoParentPath = (Split-Path -Path "$destinationIsoPath" -Parent);
### This is the directory where the DaRT ISO file will be saved.
$TempMountPath = "$env:temp\DaRT8Mount_$(Get-Random)";
### Specify the temporary directory used to mount the Windows image.

###
### Prepare the windows image.
###

### Guarantee the output directories exists.
New-Item -Path $WimParentPath -Type Directory -Force
New-Item -Path $IsoParentPath -Type Directory -Force
New-Item -Path $TempMountPath -Type Directory -Force

### Create a copy of the WIM and remove the read-only attribute.
### The WIM file will be the resulting dart image.
Copy-Item "$Win8MediaPath\sources\boot.wim" $DestinationWimPath -Force
Set-ItemProperty $DestinationWimPath -Name IsReadOnly -Value $false

### Mount the bootable image within the WIM file (normally index 2).
Mount-WindowsImage -ImagePath $DestinationWimPath -Path $TempMountPath -Index 2

###
### Add additional drivers to the image.
###

###
### Installs the specified driver(s) into the image.
###

Add-WindowsDriver -Path $TempMountPath -Driver "C:\Windows\System32\DriverStore\FileRepository
\xusb22.inf_amd64_89c20c625f14f923\xusb22.inf" -ForceUnsigned

###
### Add additional drivers to the image.
###

###
### Installs the specified WinPE package(s) into the image.
###

Add-WindowsPackage -Path $TempMountPath -PackagePath "C:\Program Files (x86)\Windows Kits\8.0\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-Scripting.cab"
Add-WindowsPackage -Path $TempMountPath -PackagePath "C:\Program Files (x86)\Windows Kits\8.0\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-FMAPI.cab"
Add-WindowsPackage -Path $TempMountPath -PackagePath "C:\Program Files (x86)\Windows Kits\8.0\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-Scripting_en-us.cab"
Add-WindowsPackage -Path $TempMountPath -PackagePath "C:\Program Files (x86)\Windows Kits\8.0\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-HTA.cab"
Add-WindowsPackage -Path $TempMountPath -PackagePath "C:\Program Files (x86)\Windows Kits\8.0\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-HTA_en-us.cab"

###
### Add the DaRT tools to the image.
### The New-DartConfiguration cmdlet is used to specify how the DaRT image is configured.
### Modify this statement to configure how the DaRT tools will be applied to the image.
###

$config = New-DartConfiguration -AddComputerManagement -AddCrashAnalyzer -AddDefender -AddDiskCommander -AddExplorer -AddFileRestore -AddFileSearch -AddHotfixUninstall -AddRegistryEditor -AddRemoteConnection -AddSfcScan -AddSolutionWizard -AddTcpConfig -RemoteMessage "Test welcome message" -RemotePort 3388 -ScratchSpace 512 -UpdateDefender
$config | Set-DartImage -Path $TempMountPath

###
### Perform any manual user-specific customizations here.
###

# Read-Host -Prompt "Script is paused for any manual customization. Press ENTER to continue"

### Save the changes to the WIM file by dismounting the image.
Dismount-WindowsImage -Path $TempMountPath -Save

### Create a bootable DaRT ISO.
Export-DartImage -IsoPath $DestinationIsoPath -WimPath $DestinationWimPath

### The following is an example of how to burn the ISO to a writeable CD/DVD.
### Specify the correct drive letter and uncomment the statement to burn an ISO.
# Copy-DartImage -IsoPath $DestinationIsoPath -Drive "G:" -Type DVD

### Removes all temporary files.
Remove-Item $TempMountPath -Force -Recurse

注意

機械翻訳に関する免責事項: コンピューター システム ユーザーによる介入操作なしでこの記事を翻訳されています。マイクロソフトでは、英語を話さないユーザーがマイクロソフトの製品、サービス、テクノロジに関するコンテンツを理解するのに役立てるため、こうした機械翻訳を提供しています。記事は機械翻訳されているため、用語、構文、文法などに誤りがある場合があります。

参照:

その他のリソース

8.0 の DaRT を使用して PowerShell [DaRT_8] を管理します。

-----
MDOP の詳細については、TechNet ライブラリを参照してください。また、TechNet Wiki を検索して問題を解決したり、マイクロソフトの Facebook または Twitter をフォローしたりすることができます。
-----