-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathGet-InstalledUpdates.ps1
More file actions
29 lines (24 loc) · 1.03 KB
/
Copy pathGet-InstalledUpdates.ps1
File metadata and controls
29 lines (24 loc) · 1.03 KB
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
#ValidationTags#Messaging,FlowControl,Pipeline,CodeStyle#
function Get-InstalledUpdates {
<#
.SYNOPSIS
Returns all updates against the system.
.DESCRIPTION
This script is part of the ITAM process and is called by the Start-ServerAssetScan.ps1 script
.PARAMETER WhatIf
Shows what would happen if the command were to run. No actions are actually performed.
.EXAMPLE
PS C:\> Get-InstalledUpdates -AssetID 1000 -AssetName LocalHost -AssetType 1
Runs a check against all installed updates for the local system.
#>
[CmdletBinding()]
param (
[object[]]$AssetID,
[object[]]$AssetName,
[object[]]$AssetType
)
process {
$MyResults = Get-HotFix -ComputerName $AssetName | Select-Object @{N='Asset_ID';E={$AssetID}}, Description, HotFixID, InstalledBy, InstalledOn | ConvertTo-DbaDataTable
Write-DbaDataTable -InputObject $MyResults -SqlInstance Localhost -Database ITAM -Table Stage.Server_Updates -AutoCreateTable -Verbose
}
}