OS Guide: Slipstream Updates Using DISM and OSCDImg

Updated 2018-12-11

NOTE: Servicing Stack Updates KB4132216 and KB4465659 should be left in the Updates_WinServ folder! Place the latest Server 2016 CU in there as well to allow it to run successfully.

We tweaked the script and folder to create a new one for Server 2019.

The following is the script used to update the Install.WIM file and create a new .ISO file once the process completes.

An elevated command prompt is required.

To check on the Index ID held in the Install.WIM file:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
REM **** UPDATE the date in the ISO Name - Current: 2018-10-09.ISO ****

ECHO Rename the TXT Files
REN L:\USB_Images\_WinServ2019FULL\_WinServe19-2018-10-01.txt _WinServe19-2018-10-09.txt
REN L:\USB_Images\_WinServ2019Bare\_WinServe19-2018-10-01.txt _WinServe19-2018-10-09.txt

ECHO Freshen Up the WIM File!
XCopy L:\WIMWork\WinServ19BareWIM\install.wim L:\WIMWork\WinServ19WIM /Y

ECHO **** MOUNT INDEX 1 ****
DISM /Mount-Wim /WimFile:L:\WIMWork\WinServ19WIM\install.wim /Index:1 /MountDir:L:\WIMWork\Mount_WinServ
ECHO **** UPDATE INDEX 1 ****
DISM /Image:L:\WIMWork\Mount_WinServ /Add-Package /PackagePath:L:\WIMWork\Updates_WinServ
ECHO **** UNMOUNT INDEX 1 ****
DISM /unmount-Wim /MountDir:L:\WIMWork\Mount_WinServ /commit
ECHO **** FINISH INDEX 1 ****
DISM /Cleanup-Wim

ECHO **** MOUNT INDEX 2 ****
DISM /Mount-Wim /WimFile:L:\WIMWork\WinServ19WIM\install.wim /Index:2 /MountDir:L:\WIMWork\Mount_WinServ
ECHO **** UPDATE INDEX 2 ****
DISM /Image:L:\WIMWork\Mount_WinServ /Add-Package /PackagePath:L:\WIMWork\Updates_WinServ
ECHO **** UNMOUNT INDEX 2 ****
DISM /unmount-Wim /MountDir:L:\WIMWork\Mount_WinServ /commit
ECHO **** FINISH INDEX 2 ****
DISM /Cleanup-Wim

ECHO **** MOUNT INDEX 3 ****
DISM /Mount-Wim /WimFile:L:\WIMWork\WinServ19WIM\install.wim /Index:3 /MountDir:L:\WIMWork\Mount_WinServ
ECHO **** UPDATE INDEX 3 ****
DISM /Image:L:\WIMWork\Mount_WinServ /Add-Package /PackagePath:L:\WIMWork\Updates_WinServ
ECHO **** UNMOUNT INDEX 3 ****
DISM /unmount-Wim /MountDir:L:\WIMWork\Mount_WinServ /commit
ECHO **** FINISH INDEX 3 ****
DISM /Cleanup-Wim

ECHO **** MOUNT INDEX 4 ****
DISM /Mount-Wim /WimFile:L:\WIMWork\WinServ19WIM\install.wim /Index:4 /MountDir:L:\WIMWork\Mount_WinServ
ECHO **** UPDATE INDEX 4 ****
DISM /Image:L:\WIMWork\Mount_WinServ /Add-Package /PackagePath:L:\WIMWork\Updates_WinServ
ECHO **** UNMOUNT INDEX 4 ****
DISM /unmount-Wim /MountDir:L:\WIMWork\Mount_WinServ /commit
ECHO **** FINISH INDEX 4 ****
DISM /Cleanup-Wim

ECHO **** COPY WIM FILES ****
XCopy L:\WIMWork\WinServ19WIM\install.wim L:\USB_Images\_WinServ2019FULL\sources\install.wim /Y
XCopy L:\WIMWork\WinServ19WIM\install.wim L:\USB_Images\_WinServ2019Bare\sources\install.wim /Y

ECHO **** CREATE ISO FILE ****
C:
CD \Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\amd64\Oscdimg
Oscdimg.exe -u2 -bL:\USB_Images\_WinServ2019Bare\efi\microsoft\boot\efisys.bin -h L:\USB_Images\_WinServ2019Bare L:\ISOs\WinServ19B-2018-10-09.ISO
XCopy L:\ISOs\WinServ19B-2018-10-09.ISO L:\USB_Images\_WinServ2019FULL\_ISOs /Y
Oscdimg.exe -u2 -bL:\USB_Images\_WinServ2019Bare\efi\microsoft\boot\efisys.bin -h L:\USB_Images\_WinServ2019FULL L:\ISOs\WinServ19F-2018-10-09.ISO
CD \
Explorer.exe L:\ISOs

ECHO **** DONE ****