File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -18,12 +18,12 @@ if ($updates) {
1818 }
1919}
2020```
21- # If you want to exclude KBIDs
21+ # If you want to exclude KBIDs and updates for specific hardware ID's
2222
2323``` powershell
2424Import-Module WindowsUpdates
2525
26- $updates = Get-WindowsUpdate -Verbose -ExcludeKBId @("KB2267602")
26+ $updates = Get-WindowsUpdate -Verbose -ExcludeKBId @("KB2267602") -ExcludeHardwareId @("{084f01fa-e634-4d77-83ee-074817c03581}")
2727```
2828
2929## Compatibility
Original file line number Diff line number Diff line change @@ -93,7 +93,9 @@ function Get-WindowsUpdate {
9393 [CmdletBinding ()]
9494 Param (
9595 [Parameter (Mandatory = $false )]
96- [array ]$ExcludeKBId = @ ()
96+ [array ]$ExcludeKBId = @ (),
97+ [Parameter (Mandatory = $false )]
98+ [array ]$ExcludeHardwareId = @ ()
9799 )
98100 PROCESS {
99101 $updateSearcher = Get-UpdateSearcher
@@ -108,13 +110,14 @@ function Get-WindowsUpdate {
108110 }
109111 $updates = $updateResult.Updates
110112 $filteredUpdates = New-Object - ComObject $UPDATE_COLL_COM_CLASS
111-
112113 for ($i = 0 ; $i -lt $updates.Count ; $i ++ ) {
113114 $update = $updates.Item ($i )
114115 $updateKBId = ($update.KBArticleIDs -join " , KB" )
115116 if ($ExcludeKBId -contains (" KB" + $updateKBId )) {
116117 Write-Verbose (" Exclude update KB{0}" `
117118 -f @ ($updateKBId ))
119+ } elseif ($ExcludeHardwareId -contains $update.DriverHardwareID ) {
120+ Write-Verbose (" Exclude update: {0}" -f @ ($Title ))
118121 } else {
119122 Add-WindowsUpdateToCollection $filteredUpdates $update
120123 }
You can’t perform that action at this time.
0 commit comments