Commit 102f6fbf authored by bigwave's avatar bigwave
Browse files

Stop SearchResult display failing

I've lost the URL explaining what the problem was, but the gist of it
was that something in the -Property list has already been formatted, so
piping it into Format-List makes it choke.

This should stop the script throwing exceptions displaying this info,
but I've left the exception handling in as it can't hurt
parent 9cee32ad
......@@ -192,7 +192,12 @@ function Check-WindowsUpdates() {
$Message = "There are " + $SearchResult.Updates.Count + " more updates."
LogWrite $Message
try {
$script:SearchResult.Updates |Select-Object -Property Title, Description, SupportUrl, UninstallationNotes, RebootRequired, EulaAccepted |Format-List
for($i=0; $i -lt $script:SearchResult.Updates.Count; $i++) {
LogWrite $script:SearchResult.Updates.Item($i).Title
LogWrite $script:SearchResult.Updates.Item($i).Description
LogWrite $script:SearchResult.Updates.Item($i).RebootRequired
LogWrite $script:SearchResult.Updates.Item($i).EulaAccepted
} catch {
LogWrite $_.Exception | Format-List -force
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment