-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathRemove Capabilities.ps1
22 lines (20 loc) · 1.06 KB
/
Remove Capabilities.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# A string list which has listed capabilities or FoD to be disabled and removed.
$flist = @("*Realtek*", "*Intel*", "*Broadcom*", "*Qualcomm*", "*Marvel*",
"*Vmware*", "*Ethernet*", "*InternetExplorer*", "*StepsRecorder*",
"*DirectX.Configuration.Database*", "*WindowsMediaPlayer*",
"*Wallpapers*", "*Print*", "*MathRecognizer*", "*OpenSSH*", "*PowerShell*",
"*QuickAssist*", "*OneSync*", "*LA57*", "*Ralink*", "*Virtual*", "*TCP*", "*Hello*")
foreach ($item in $flist) {
# Get the list of capabilities that match the current item
$checkCapabilities = Get-WindowsCapability -Online | Where-Object { $_.Name -like $item }
foreach ($checkCapability in $checkCapabilities) {
if ($checkCapability.State -eq 'Installed') {
try {
# Remove each capability found
Remove-WindowsCapability -Online -Name $checkCapability.Name -ErrorAction Stop
} catch {
Write-Host "Error at $($checkCapability.Name): $($_.Exception.Message)"
}
}
}
}