Get Windows Update last run date

Another one I use often to check the last time Windows Updates ran on a device

Import-Module $env:SyncroModule

$LastInstallationSuccessDate = (Get-HotFix | Measure-Object -Maximum InstalledOn).Maximum | Out-string
$LastInstallationSuccessDate = $LastInstallationSuccessDate.trim()
$LastInstallationSuccessDate = $LastInstallationSuccessDate.Replace("00:00:00","")
$LastInstallationSuccessDate = $LastInstallationSuccessDate.Replace("12:00:00 AM","")
Write-Host $LastInstallationSuccessDate

Set-Asset-Field -Name "WU Installation Success Date" -Value $LastInstallationSuccessDate

And you can also use this one to get the number of updates pending for each assett.

Import-Module $env:SyncroModule

$UpdateSession = New-Object -ComObject Microsoft.Update.Session
$UpdateSearcher = $UpdateSession.CreateupdateSearcher()
$Updates = @($UpdateSearcher.Search("IsInstalled=0 and Type='Software'").Updates)

#This will give the number of updates yet to install.

Write-Host $Updates.Title.count

Set-Asset-Field -Name "WU Pending" -Value $Updates.Title.count