mirror of
https://github.com/MicrosoftDocs/windows-itpro-docs.git
synced 2025-06-17 11:23:45 +00:00
Merge branch 'master' into repo_sync_working_branch
This commit is contained in:
@ -107,7 +107,7 @@ These examples are for illustration only, and therefore lack error handling. The
|
||||
|
||||
The script starts by declaring global variables and creating folders to use for mounting images. Then, make a copy of the original media, from \oldMedia to \newMedia, keeping the original media in case there is a script error and it's necessary to start over from a known state. Also, it will provide a comparison of old versus new media to evaluate changes. To ensure that the new media updates, make sure they are not read-only.
|
||||
|
||||
```
|
||||
```powershell
|
||||
function Get-TS { return "{0:HH:mm:ss}" -f (Get-Date) }
|
||||
|
||||
Write-Host "$(Get-TS): Starting media refresh"
|
||||
@ -160,21 +160,21 @@ New-Item -ItemType directory -Path $MAIN_OS_MOUNT -ErrorAction stop | Out-Null
|
||||
New-Item -ItemType directory -Path $WINRE_MOUNT -ErrorAction stop | Out-Null
|
||||
New-Item -ItemType directory -Path $WINPE_MOUNT -ErrorAction stop | Out-Null
|
||||
|
||||
# Keep the original media, make a copy of it for the new, updateed media.
|
||||
# Keep the original media, make a copy of it for the new, updated media.
|
||||
Write-Host "$(Get-TS): Copying original media to new media path"
|
||||
Copy-Item -Path $MEDIA_OLD_PATH"\*" -Destination $MEDIA_NEW_PATH -Force -Recurse -ErrorAction stop | Out-Null
|
||||
Get-ChildItem -Path $MEDIA_NEW_PATH -Recurse | Where-Object { -not $_.PSIsContainer -and $_.IsReadOnly } | ForEach-Object { $_.IsReadOnly = $false }
|
||||
```
|
||||
### Update WinRE
|
||||
|
||||
The script assumes that only a single edition is being updated, indicated by Index = 1 (Windows 10 Education Edition). Then the script mounts the image, saves Winre.wim to the working folder, and mounts it. It then applies servicing stack Dynamic Update, since its s are used for updating other s. Since the script is optionally adding Japanese, it adds the language pack to the image, and installs the Japanese versions of all optional packages already installed in Winre.wim. Then, it applies the Safe OS Dynamic Update package.
|
||||
The script assumes that only a single edition is being updated, indicated by Index = 1 (Windows 10 Education Edition). Then the script mounts the image, saves Winre.wim to the working folder, and mounts it. It then applies servicing stack Dynamic Update, since its components are used for updating other components. Since the script is optionally adding Japanese, it adds the language pack to the image, and installs the Japanese versions of all optional packages already installed in Winre.wim. Then, it applies the Safe OS Dynamic Update package.
|
||||
|
||||
It finishes by cleaning and exporting the image to reduce the image size.
|
||||
|
||||
> [!NOTE]
|
||||
> Skip adding the latest cumulative update to Winre.wim because it contains unnecessary s in the recovery environment. The s that are updated and applicable are contained in the safe operating system Dynamic Update package. This also helps to keep the image small.
|
||||
> Skip adding the latest cumulative update to Winre.wim because it contains unnecessary components in the recovery environment. The components that are updated and applicable are contained in the safe operating system Dynamic Update package. This also helps to keep the image small.
|
||||
|
||||
```
|
||||
```powershell
|
||||
# Mount the main operating system, used throughout the script
|
||||
Write-Host "$(Get-TS): Mounting main OS"
|
||||
Mount-WindowsImage -ImagePath $MEDIA_NEW_PATH"\sources\install.wim" -Index 1 -Path $MAIN_OS_MOUNT -ErrorAction stop| Out-Null
|
||||
@ -255,7 +255,7 @@ Move-Item -Path $WORKING_PATH"\winre2.wim" -Destination $WORKING_PATH"\winre.wim
|
||||
|
||||
This script is similar to the one that updates WinRE, but instead it mounts Boot.wim, applies the packages with the latest cumulative update last, and saves. It repeats this for all images inside of Boot.wim, typically two images. It starts by applying the servicing stack Dynamic Update. Since the script is customizing this media with Japanese, it installs the language pack from the WinPE folder on the language pack ISO. Additionally, add font support and text to speech (TTS) support. Since the script is adding a new language, it rebuilds lang.ini, used to identify languages installed in the image. Finally, it cleans and exports Boot.wim, and copies it back to the new media.
|
||||
|
||||
```
|
||||
```powershell
|
||||
#
|
||||
# update Windows Preinstallation Environment (WinPE)
|
||||
#
|
||||
@ -349,7 +349,7 @@ Now is the time to enable other Optional Components or add other Features on Dem
|
||||
|
||||
You can install Optional Components, along with the .Net feature, offline, but that will require the device to be restarted. This is why the script installs .Net and Optional Components after cleanup and before export.
|
||||
|
||||
```
|
||||
```powershell
|
||||
#
|
||||
# update Main OS
|
||||
#
|
||||
@ -422,7 +422,7 @@ Move-Item -Path $WORKING_PATH"\install2.wim" -Destination $MEDIA_NEW_PATH"\sourc
|
||||
|
||||
This part of the script updates the Setup files. It simply copies the individual files in the Setup Dynamic Update package to the new media. This step brings an updated Setup.exe as needed, along with the latest compatibility database, and replacement component manifests.
|
||||
|
||||
```
|
||||
```powershell
|
||||
#
|
||||
# update remaining files on media
|
||||
#
|
||||
@ -435,7 +435,7 @@ cmd.exe /c $env:SystemRoot\System32\expand.exe $SETUP_DU_PATH -F:* $MEDIA_NEW_PA
|
||||
|
||||
As a last step, the script removes the working folder of temporary files, and unmounts our language pack and Features on Demand ISOs.
|
||||
|
||||
```
|
||||
```powershell
|
||||
#
|
||||
# Perform final cleanup
|
||||
#
|
||||
|
Reference in New Issue
Block a user