From 154314f4d146eab6d7682fa1a98ed3e4da1f2aa0 Mon Sep 17 00:00:00 2001 From: Rui Lopes Date: Thu, 11 Jul 2024 02:02:05 +0100 Subject: [PATCH] ignore updates without a title --- README.md | 2 +- update/windows-update.ps1 | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 89baa1c..47037c6 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Configure your packer template to require a [release version of the plugin](http packer { required_plugins { windows-update = { - version = "0.16.3" + version = "0.16.4" source = "github.com/rgl/windows-update" } } diff --git a/update/windows-update.ps1 b/update/windows-update.ps1 index af52c1b..1f8c9f3 100644 --- a/update/windows-update.ps1 +++ b/update/windows-update.ps1 @@ -190,10 +190,15 @@ for ($i = 0; $i -lt $searchResult.Updates.Count; ++$i) { if (!$update) { continue } + + $updateTitle = $update.Title + if (!$updateTitle) { + continue + } + $updateMaxDownloadSize = try { [int64]$update.MaxDownloadSize } catch { [int64]0 } $updateDate = try { $update.LastDeploymentChangeTime.ToString('yyyy-MM-dd') } catch { '1970-01-01' } $updateSize = ($updateMaxDownloadSize/1024/1024).ToString('0.##') - $updateTitle = $update.Title $updateSummary = "Windows update ($updateDate; $updateSize MB): $updateTitle" if (!(Test-IncludeUpdate $updateFilters $update)) {