-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathremove-built-in-win10-ISO-apps.ps1
230 lines (145 loc) · 7.66 KB
/
remove-built-in-win10-ISO-apps.ps1
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
<#
Create new iso from updated wim file
https://www.thomasmaurer.ch/2013/03/add-drivers-to-windows-server-2012-iso-image/
#oscdimg -n -m -bc:\temp\ISO\boot\etfsboot.com C:\temp\ISO C:\temp\mynew.iso
https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/oscdimg-command-line-options
Convert esd file to wim file
https://www.intel.com/content/www/us/en/support/articles/000023992/memory-and-storage/intel-optane-memory.html
#>
#Requires -RunAsAdministrator
Add-Type -AssemblyName System.Windows.Forms
Function Set-WimFile {
$fileSelector = New-Object System.Windows.Forms.OpenFileDialog -Property @{
InitialDirectory = [System.Environment]::GetFolderPath('Desktop')
Filter = 'WIM (*.wim, *.esd)|*.wim;*.esd'
}
$null = $fileSelector.ShowDialog()
$wimFile = $fileSelector.FileName
return $wimFile
}
Function Set-Directory {
$folderSelector = New-Object System.Windows.Forms.FolderBrowserDialog
$folderSelector.SelectedPath = "C:\WIM_Temp"
$folderSelector.ShowNewFolderButton = $true
$folderSelector.Description = "Select a directory."
$null = $folderSelector.ShowDialog()
$tempDirectory = $folderSelector.SelectedPath
return $tempDirectory
}
Function Set-DesiredImageIndex($index, $wim, $destination, $newImageName) {
Export-WindowsImage -SourceImagePath $wim -SourceIndex $index -DestinationImagePath $destination -DestinationName $newImageName -CompressionType max -CheckIntegrity
}
Function Remove-BuiltInApps($selectedVersion, $tempDir) {
# Windows 10 21H2 versions
$appsToRemoveWin10_21H2 = @("Microsoft.BingWeather_4.25.20211.0_neutral_~_8wekyb3d8bbwe",
"Microsoft.Getstarted_8.2.22942.0_neutral_~_8wekyb3d8bbwe",
"Microsoft.Microsoft3DViewer_6.1908.2042.0_neutral_~_8wekyb3d8bbwe",
"Microsoft.MicrosoftOfficeHub_18.1903.1152.0_neutral_~_8wekyb3d8bbwe",
"Microsoft.MicrosoftSolitaireCollection_4.4.8204.0_neutral_~_8wekyb3d8bbwe",
"Microsoft.MixedReality.Portal_2000.19081.1301.0_neutral_~_8wekyb3d8bbwe",
"Microsoft.Office.OneNote_16001.12026.20112.0_neutral_~_8wekyb3d8bbwe",
"Microsoft.People_2019.305.632.0_neutral_~_8wekyb3d8bbwe",
"Microsoft.SkypeApp_14.53.77.0_neutral_~_kzf8qxf38zg5c",
"Microsoft.Wallet_2.4.18324.0_neutral_~_8wekyb3d8bbwe",
"microsoft.windowscommunicationsapps_16005.11629.20316.0_neutral_~_8wekyb3d8bbwe",
"Microsoft.WindowsFeedbackHub_2019.1111.2029.0_neutral_~_8wekyb3d8bbwe",
"Microsoft.WindowsMaps_2019.716.2316.0_neutral_~_8wekyb3d8bbwe",
"Microsoft.Xbox.TCUI_1.23.28002.0_neutral_~_8wekyb3d8bbwe",
"Microsoft.XboxApp_48.49.31001.0_neutral_~_8wekyb3d8bbwe",
"Microsoft.XboxGameOverlay_1.46.11001.0_neutral_~_8wekyb3d8bbwe",
"Microsoft.XboxGamingOverlay_2.34.28001.0_neutral_~_8wekyb3d8bbwe",
"Microsoft.XboxIdentityProvider_12.50.6001.0_neutral_~_8wekyb3d8bbwe",
"Microsoft.YourPhone_2019.430.2026.0_neutral_~_8wekyb3d8bbwe")
$appsToRemoveWin11_21H2 = @("Microsoft.BingNews_4.7.28001.0_neutral_~_8wekyb3d8bbwe",
"Microsoft.BingWeather_4.25.20211.0_neutral_~_8wekyb3d8bbwe",
"Microsoft.WindowsMaps_2022.2205.9.0_neutral_~_8wekyb3d8bbwe",
"Microsoft.GamingApp_2207.1001.6.0_neutral_~_8wekyb3d8bbwe",
"Microsoft.Getstarted_10.2.41172.0_neutral_~_8wekyb3d8bbwe",
"Microsoft.Microsoft3DViewer_6.1908.2042.0_neutral_~_8wekyb3d8bbwe",
"Microsoft.MicrosoftSolitaireCollection_4.6.3102.0_neutral_~_8wekyb3d8bbwe",
"Microsoft.MicrosoftOfficeHub_18.2205.1091.0_neutral_~_8wekyb3d8bbwe",
"Microsoft.MixedReality.Portal_2000.19081.1301.0_neutral_~_8wekyb3d8bbwe",
"Microsoft.Office.OneNote_16001.12026.20112.0_neutral_~_8wekyb3d8bbwe",
"Microsoft.People_2021.2105.4.0_neutral_~_8wekyb3d8bbwe",
"Microsoft.SkypeApp_14.53.77.0_neutral_~_kzf8qxf38zg5c",
"Microsoft.Wallet_2.4.18324.0_neutral_~_8wekyb3d8bbwe",
"microsoft.windowscommunicationsapps_16005.12827.20400.0_neutral_~_8wekyb3d8bbwe",
"Microsoft.WindowsFeedbackHub_2021.427.1821.0_neutral_~_8wekyb3d8bbwe",
"Microsoft.Xbox.TCUI_1.24.10001.0_neutral_~_8wekyb3d8bbwe",
"Microsoft.XboxApp_48.49.31001.0_neutral_~_8wekyb3d8bbwe",
"Microsoft.XboxGameOverlay_1.54.4001.0_neutral_~_8wekyb3d8bbwe",
"Microsoft.XboxGamingOverlay_5.822.6271.0_neutral_~_8wekyb3d8bbwe",
"Microsoft.XboxIdentityProvider_12.90.14001.0_neutral_~_8wekyb3d8bbwe",
"Microsoft.XboxSpeechToTextOverlay_1.21.13002.0_neutral_~_8wekyb3d8bbwe")
Switch($selectedVersion) {
10 {
foreach ($currentApp in $appsToRemoveWin10_21H2) {
Write-Host "Removing app: $currentApp"
Remove-AppxProvisionedPackage -Path $tempDir -PackageName $currentApp
}
}
11 {
ForEach ($currentApp in $appsToRemoveWin11_21H2) {
Write-Host "Removing app: $currentApp"
Remove-AppxProvisionedPackage -Path $tempDir -PackageName $currentApp
}
}
Default {
Write-Host "You picked a version of windows that I don't know about yet. Please start over."
Write-Host "Exiting....."
Exit
}
}
}
Write-Host "Which version of Windows are you editing? 10 or 11? : " -NoNewline -ForegroundColor Yellow
$winVersion = Read-Host
Write-Host "Select the .wim/.esd file to edit. Opening file selector dialog."
Start-Sleep 3
$wimFile = Set-WimFile
#DISM show available images inside of wim
Write-Host "Which image index do you wish to edit? Displaying index now:"
Start-Sleep 3
Get-WindowsImage -ImagePath $wimFile
$imageIndex = Read-Host "Select index number: "
Write-Host "Please select the temporary directory to mount the image in and process the changes"
Write-Host "Launching the folder picker...."
Start-Sleep 3
$tempDirectory = Set-Directory
Write-Host "Please select the destination directory to save the new wim file to:"
Write-Host "Launching the folder picker....."
Start-Sleep 3
$destinationDirectory = Set-Directory
$destinationFile = $destinationDirectory + "\$imageIndex.wim"
Write-Host "Give your new image a custom name. EX: 'Win10 Pro - No Apps'"
$customName = Read-Host "Custom image name: "
Write-Host ""
Write-Host ""
Write-Host "You chose the following settings:"
Write-Host "Windows version = $winVersion"
Write-Host "WIM file = $wimFile"
Write-Host "Index # = $imageIndex"
Write-Host "Temp working directory = $tempDirectory"
Write-Host "Destination directory/file = $destinationFile"
Write-Host "Custom image name = $customName"
Write-Host ""
$confirmSettings = Read-Host "Please confirm your settings. ( y/n ): "
IF ($confirmSettings -eq "y" -or "yes") {
# extract index from wim or esd file
Write-Host "Extracting desired image index to destination for future editing"
Set-DesiredImageIndex $imageIndex $wimFile $destinationFile $customName
# Mount image in temp folder
Write-Host "Mounting index for editing."
Mount-WindowsImage -ImagePath $destinationFile -Index 1 -Path $tempDirectory
#remove apps
Write-Host "Removing built-in apps."
Remove-BuiltInApps $winVersion $tempDirectory
#dismount image
Write-Host "Dismounting the wim file."
Dismount-WindowsImage -Path $tempDirectory -Save
Rename-Item -Path $destinationFile -NewName "install.wim"
Write-Host "Finished with edits."
}ELSE {
Write-Host "I don't know what you responded with. Please start over. Exiting...."
Exit
}