Edit-ADKwinpe.wim
This really is a great function if you are looking to speed things up with ADK's WinPE.wim. I end up ALWAYS adding PowerShell to WinPE and that takes time with .NET and all the other packages
What this function will do is back up the existing ADK winpe.wim, and modify the amd64 winpe.wim with the following changes
    All the cool ADK Packages for PowerShell support
    cURL.exe will be added copied (if you have it in your host OS)
    PowerShell ExecutionPolicy will be set to Bypass
    Volatile Paths will be added (APPDATA, LOCALAPPDATA)
      Required for PackageManagement
    PackageManagement
      Required for PowerShell Gallery
    PowerShellGet
      Required for PowerShell Gallery
I made sure to add a TimeSpan to show how much time you will save every time you create WinPE going forward. In my case, 4.5 minutes! Now before you say anything, yes it is ugly with everything VERBOSE, but I believe that if you are editing your master winpe.wim, you better make sure you know what is happening to it
1
PS C:\WINDOWS\system32> Edit-ADKWinPE.wim
2
3
VERBOSE: Performing the operation "Copy File" on target "Item: C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\en-us\winpe.wim Destination: C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows
4
Preinstallation Environment\amd64\en-us\winpe.bak".
5
VERBOSE: C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\en-us\winpe.wim
6
VERBOSE: Target Image Version 10.0.19041.1
7
VERBOSE: Successfully added package C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-WMI.cab
8
9
Path : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
10
Online : False
11
RestartNeeded : False
12
13
VERBOSE: Target Image Version 10.0.19041.1
14
VERBOSE: Successfully added package C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-WMI_en-us.cab
15
Path : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
16
Online : False
17
RestartNeeded : False
18
19
VERBOSE: Target Image Version 10.0.19041.1
20
VERBOSE: Successfully added package C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-HTA.cab
21
Path : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
22
Online : False
23
RestartNeeded : False
24
25
VERBOSE: Target Image Version 10.0.19041.1
26
VERBOSE: Successfully added package C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-HTA_en-us.cab
27
Path : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
28
Online : False
29
RestartNeeded : False
30
31
VERBOSE: Target Image Version 10.0.19041.1
32
VERBOSE: Successfully added package C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-NetFx.cab
33
Path : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
34
Online : False
35
RestartNeeded : False
36
37
VERBOSE: Target Image Version 10.0.19041.1
38
VERBOSE: Successfully added package C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-NetFx_en-us.cab
39
Path : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
40
Online : False
41
RestartNeeded : False
42
43
VERBOSE: Target Image Version 10.0.19041.1
44
VERBOSE: Successfully added package C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-Scripting.cab
45
Path : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
46
Online : False
47
RestartNeeded : False
48
49
VERBOSE: Target Image Version 10.0.19041.1
50
VERBOSE: Successfully added package C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-Scripting_en-us.cab
51
Path : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
52
Online : False
53
RestartNeeded : False
54
55
VERBOSE: Target Image Version 10.0.19041.1
56
VERBOSE: Successfully added package C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-PowerShell.cab
57
Path : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
58
Online : False
59
RestartNeeded : False
60
61
VERBOSE: Target Image Version 10.0.19041.1
62
VERBOSE: Successfully added package C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-PowerShell_en-us.cab
63
Path : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
64
Online : False
65
RestartNeeded : False
66
67
VERBOSE: Target Image Version 10.0.19041.1
68
VERBOSE: Successfully added package C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-SecureStartup.cab
69
Path : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
70
Online : False
71
RestartNeeded : False
72
73
VERBOSE: Target Image Version 10.0.19041.1
74
VERBOSE: Successfully added package C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-SecureStartup_en-us.cab
75
Path : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
76
Online : False
77
RestartNeeded : False
78
79
VERBOSE: Target Image Version 10.0.19041.1
80
VERBOSE: Successfully added package C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-DismCmdlets.cab
81
Path : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
82
Online : False
83
RestartNeeded : False
84
85
VERBOSE: Target Image Version 10.0.19041.1
86
VERBOSE: Successfully added package C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-DismCmdlets_en-us.cab
87
Path : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
88
Online : False
89
RestartNeeded : False
90
91
VERBOSE: Target Image Version 10.0.19041.1
92
VERBOSE: Successfully added package C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-Dot3Svc.cab
93
Path : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
94
Online : False
95
RestartNeeded : False
96
97
VERBOSE: Target Image Version 10.0.19041.1
98
VERBOSE: Successfully added package C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-Dot3Svc_en-us.cab
99
Path : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
100
Online : False
101
RestartNeeded : False
102
103
VERBOSE: Target Image Version 10.0.19041.1
104
VERBOSE: Successfully added package C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-EnhancedStorage.cab
105
Path : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
106
Online : False
107
RestartNeeded : False
108
109
VERBOSE: Target Image Version 10.0.19041.1
110
VERBOSE: Successfully added package C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-EnhancedStorage_en-us.cab
111
Path : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
112
Online : False
113
RestartNeeded : False
114
115
VERBOSE: Target Image Version 10.0.19041.1
116
VERBOSE: Successfully added package C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-FMAPI.cab
117
Path : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
118
Online : False
119
RestartNeeded : False
120
121
VERBOSE: Target Image Version 10.0.19041.1
122
VERBOSE: Successfully added package C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-GamingPeripherals.cab
123
Path : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
124
Online : False
125
RestartNeeded : False
126
127
VERBOSE: Target Image Version 10.0.19041.1
128
VERBOSE: Successfully added package C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-PPPoE.cab
129
Path : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
130
Online : False
131
RestartNeeded : False
132
133
VERBOSE: Target Image Version 10.0.19041.1
134
VERBOSE: Successfully added package C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-PPPoE_en-us.cab
135
Path : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
136
Online : False
137
RestartNeeded : False
138
139
VERBOSE: Target Image Version 10.0.19041.1
140
VERBOSE: Successfully added package C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-PlatformId.cab
141
Path : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
142
Online : False
143
RestartNeeded : False
144
145
VERBOSE: Target Image Version 10.0.19041.1
146
VERBOSE: Successfully added package C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-PmemCmdlets.cab
147
Path : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
148
Online : False
149
RestartNeeded : False
150
151
VERBOSE: Target Image Version 10.0.19041.1
152
VERBOSE: Successfully added package C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-PmemCmdlets_en-us.cab
153
Path : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
154
Online : False
155
RestartNeeded : False
156
157
VERBOSE: Target Image Version 10.0.19041.1
158
VERBOSE: Successfully added package C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-RNDIS.cab
159
Path : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
160
Online : False
161
RestartNeeded : False
162
163
VERBOSE: Target Image Version 10.0.19041.1
164
VERBOSE: Successfully added package C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-RNDIS_en-us.cab
165
Path : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
166
Online : False
167
RestartNeeded : False
168
169
VERBOSE: Target Image Version 10.0.19041.1
170
VERBOSE: Successfully added package C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-SecureBootCmdlets.cab
171
Path : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
172
Online : False
173
RestartNeeded : False
174
175
VERBOSE: Target Image Version 10.0.19041.1
176
VERBOSE: Successfully added package C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-StorageWMI.cab
177
Path : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
178
Online : False
179
RestartNeeded : False
180
181
VERBOSE: Target Image Version 10.0.19041.1
182
VERBOSE: Successfully added package C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-StorageWMI_en-us.cab
183
Path : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
184
Online : False
185
RestartNeeded : False
186
187
VERBOSE: Target Image Version 10.0.19041.1
188
VERBOSE: Successfully added package C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-WDS-Tools.cab
189
Path : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
190
Online : False
191
RestartNeeded : False
192
193
VERBOSE: Target Image Version 10.0.19041.1
194
VERBOSE: Successfully added package C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-WDS-Tools_en-us.cab
195
Path : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
196
Online : False
197
RestartNeeded : False
198
199
VERBOSE: Adding curl.exe to C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
200
201
VERBOSE: Setting PowerShell ExecutionPolicy to Bypass in C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
202
VERBOSE: Path: C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
203
204
LastWriteTime : 3/15/2021 9:19:50 PM
205
Length : 0
206
Name : Set-ExecutionPolicy.inf
207
208
VERBOSE: Target Image Version 10.0.19041.1
209
Path : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
210
Online : False
211
RestartNeeded : False
212
213
214
MountPath : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
215
ImagePath : C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\en-us\winpe.wim
216
ImageIndex : 1
217
MountMode : ReadWrite
218
MountStatus : Ok
219
220
VERBOSE: Enabling PowerShell Gallery support in C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
221
VERBOSE: Path: C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
222
223
LastWriteTime : 3/15/2021 9:19:51 PM
224
Length : 0
225
Name : Set-WinPEEnvironment.inf
226
227
VERBOSE: Target Image Version 10.0.19041.1
228
Path : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
229
Online : False
230
RestartNeeded : False
231
232
VERBOSE: Saving PackageManagement to C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396\Program Files\WindowsPowerShell\Modules
233
VERBOSE: Populating RepositorySourceLocation property for module PackageManagement.
234
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\PackageManagement\1.4.7\PackageManagement.psm1'.
235
VERBOSE: Populating RepositorySourceLocation property for module PackageManagement.
236
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\PackageManagement\1.4.5\PackageManagement.psm1'.
237
VERBOSE: Populating RepositorySourceLocation property for module PackageManagement.
238
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\PackageManagement\1.4.4\PackageManagement.psm1'.
239
VERBOSE: Populating RepositorySourceLocation property for module PackageManagement.
240
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\PackageManagement\1.1.1.0\PackageManagement.psm1'.
241
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\PackageManagement\1.4.7\PackageManagement.psd1'.
242
VERBOSE: Loading 'FormatsToProcess' from path 'C:\Program Files\WindowsPowerShell\Modules\PackageManagement\1.4.7\PackageManagement.format.ps1xml'.
243
VERBOSE: Populating RepositorySourceLocation property for module PackageManagement.
244
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\PackageManagement\1.4.7\PackageManagement.psm1'.
245
VERBOSE: Exporting cmdlet 'Find-Package'.
246
VERBOSE: Exporting cmdlet 'Find-PackageProvider'.
247
VERBOSE: Exporting cmdlet 'Get-Package'.
248
VERBOSE: Exporting cmdlet 'Get-PackageProvider'.
249
VERBOSE: Exporting cmdlet 'Get-PackageSource'.
250
VERBOSE: Exporting cmdlet 'Import-PackageProvider'.
251
VERBOSE: Exporting cmdlet 'Install-Package'.
252
VERBOSE: Exporting cmdlet 'Install-PackageProvider'.
253
VERBOSE: Exporting cmdlet 'Register-PackageSource'.
254
VERBOSE: Exporting cmdlet 'Save-Package'.
255
VERBOSE: Exporting cmdlet 'Set-PackageSource'.
256
VERBOSE: Exporting cmdlet 'Uninstall-Package'.
257
VERBOSE: Exporting cmdlet 'Unregister-PackageSource'.
258
VERBOSE: Importing cmdlet 'Find-Package'.
259
VERBOSE: Importing cmdlet 'Find-PackageProvider'.
260
VERBOSE: Importing cmdlet 'Get-Package'.
261
VERBOSE: Importing cmdlet 'Get-PackageProvider'.
262
VERBOSE: Importing cmdlet 'Get-PackageSource'.
263
VERBOSE: Importing cmdlet 'Import-PackageProvider'.
264
VERBOSE: Importing cmdlet 'Install-Package'.
265
VERBOSE: Importing cmdlet 'Install-PackageProvider'.
266
VERBOSE: Importing cmdlet 'Register-PackageSource'.
267
VERBOSE: Importing cmdlet 'Save-Package'.
268
VERBOSE: Importing cmdlet 'Set-PackageSource'.
269
VERBOSE: Importing cmdlet 'Uninstall-Package'.
270
VERBOSE: Importing cmdlet 'Unregister-PackageSource'.
271
VERBOSE: Saving PowerShellGet to C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396\Program Files\WindowsPowerShell\Modules
272
273
MountPath : C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
274
ImagePath : C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\en-us\winpe.wim
275
ImageIndex : 1
276
MountMode : ReadWrite
277
MountStatus : Ok
278
279
VERBOSE: Path: C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396
280
VERBOSE: Performing the operation "Dismount-MyWindowsImage -Save" on target "C:\Users\SeguraOSD\AppData\Local\Temp\Mount1574955396".
281
=========================================================================
282
2021-03-15-212107 Edit-AdkWinPE.wim Completed in 04 minutes 33 seconds
Copied!
Now with the edited winpe.wim it shaves off time considerably going forward with anything, MDT, MEM CM, or even other scripts. In the case below I was able to all of this in 1m:32s !
    Copies the winpe.wim
    Mounts winpe.wim
    Adds the same packages as Edit-AdkWinPE.wim ... so it basically skips through the process
    Dismounts winpe.wim
    Creates an ISO
Last modified 6mo ago
Copy link