Module: check_mk
Branch: master
Commit: 8bec27086d8961097655ecc8ce0e71aa98237308
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8bec27086d8961…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Fri Feb 19 15:58:06 2016 +0100
#3080 FIX windows_updates: non-ascii characters are now handled correctly
---
.werks/3080 | 10 ++++++++++
ChangeLog | 1 +
agents/windows/plugins/windows_updates.vbs | 26 +++++++++++++++++---------
3 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/.werks/3080 b/.werks/3080
new file mode 100644
index 0000000..941ea77
--- /dev/null
+++ b/.werks/3080
@@ -0,0 +1,10 @@
+Title: windows_updates: non-ascii characters are now handled correctly
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1455893821
+
+
diff --git a/ChangeLog b/ChangeLog
index cf484f9..25e6ecc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -37,6 +37,7 @@
* 3226 FIX: isc_dhcpd: Fixed exception during discovery when pools can not be
gathered by agent
* 3189 FIX: mem.vmalloc: newer kernel versions (64bit) report wrong data, i.d. both
VmallocUsed and Chunk equal zero, thus this check is obsolete
* 3079 FIX: win_printers: fixed typo that kept default parameters from being used...
+ * 3080 FIX: windows_updates: non-ascii characters are now handled correctly
* 3227 FIX: Automatic service adding: Fixed exception when using time range to skip
automatic configuration...
* 3178 FIX: docsis_channels_upstream: Fixed crash in graphs
* 3082 FIX: windows agent: with realtime updates active, shutting down the agent
could take very long
diff --git a/agents/windows/plugins/windows_updates.vbs
b/agents/windows/plugins/windows_updates.vbs
index 61fc354..c570b7a 100644
--- a/agents/windows/plugins/windows_updates.vbs
+++ b/agents/windows/plugins/windows_updates.vbs
@@ -22,6 +22,13 @@
Option Explicit
+Dim fso
+Dim objStdout
+Set fso = CreateObject("Scripting.FileSystemObject")
+' request unicode stdout and add a bom so the agent knows we send utf-16
+Set objStdout = fso.GetStandardStream(1, True)
+objStdout.Write(chrW(&HFEFF))
+
function readFromRegistry (strRegistryKey, strDefault )
Dim WSHShell, value
@@ -48,8 +55,9 @@ Set WSHShell = CreateObject("WScript.Shell")
Dim RebootTime
Dim RegPath
+
If CreateObject("Microsoft.Update.AutoUpdate").DetectNow <> 0 Then
- WScript.Echo "<<<windows_updates>>>"
+ objStdout.WriteLine "<<<windows_updates>>>"
WScript.Quit()
End If
@@ -71,9 +79,9 @@ On Error Resume Next
Set result = updtSearcher.Search("IsInstalled = 0 and IsHidden = 0")
If Err.Number <> 0 then
- WScript.Echo "<<<windows_updates>>>"
- Wscript.Echo "x x x"
- Wscript.Echo "There was an error getting update information. Maybe Windows
update is not activated. Error Number: " & Err.Number
+ objStdout.WriteLine "<<<windows_updates>>>"
+ objStdout.WriteLine "x x x"
+ objStdout.WriteLine "There was an error getting update information. Maybe
Windows update is not activated. Error Number: " & Err.Number
WScript.Quit()
End If
@@ -99,9 +107,9 @@ For Each objEntry in colDownloads
Next
-WScript.Echo "<<<windows_updates>>>"
-WScript.Echo reboot & " " & numImp & " " & numOpt
-WScript.Echo important
-WScript.Echo opti
-WScript.Echo RebootTime
+objStdout.WriteLine "<<<windows_updates>>>"
+objStdout.WriteLine reboot & " " & numImp & " " &
numOpt
+objStdout.WriteLine important
+objStdout.WriteLine opti
+objStdout.WriteLine RebootTime
WScript.Quit()