-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathCompare-InstalledUpdates.ps1
More file actions
17 lines (17 loc) · 928 Bytes
/
Compare-InstalledUpdates.ps1
File metadata and controls
17 lines (17 loc) · 928 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function Compare-InstalledUpdates {
param (
[parameter(mandatory=$true)][array]$ComputerName
)
$AllUpdates = Get-InstalledUpdates -All -ComputerName $ComputerName | Select-Object KB,Type,@{Name="ComputerName";Expression={$_.PSComputerName}}
$AllUpdateNames = $AllUpdates | select -ExpandProperty kb -Unique
foreach ($Computer in $ComputerName) {
$ComputerUpdates = $AllUpdates | Where-Object {$_.ComputerName -eq "$Computer"} | select -ExpandProperty KB -Unique
$Results = Compare-Object $AllUpdateNames $ComputerUpdates | select -ExpandProperty InputObject -Unique
$Results | foreach {
$Object = New-Object -TypeName PSObject
$Object | Add-Member -MemberType NoteProperty -Name 'ComputerName' -Value $Computer
$Object | Add-Member -MemberType NoteProperty -Name 'Name' -Value $_
$Object
}
}
}