branch in Windows.
Message-ID: <5c1b5f10.AKckFMlz1Q+7MnDJ%sk(a)mathias-kettner.de>
User-Agent: Heirloom mailx 12.5 6/20/10
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Module: check_mk
Branch: master
Commit: 38f6e99ce7cfeeeb5fdfc0fe427cafb8981c04bd
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=38f6e99ce7cfee…
Author: Sergey Kipnis <sk(a)mathias-kettner.de>
Date: Wed Dec 19 16:55:04 2018 +0100
[CMK-1454] - script to clean WMI "root/OpenHardwareMonitor" branch in Windows.
- in some cases this branch which used to create the section openhardwaremonitor" may
become not readable(not accessible)
- the script stops agent and openhardwaremoniotr, deletes branch and restarts agent
Change-Id: I825df5e87179aa5e9099ef6a2c76311cf05d4ab5
---
doc/treasures/windows/.gitignore | 3 ++-
.../windows/openhardwaremonitor-clean.cmd | 23 ++++++++++++++++++++++
doc/treasures/windows/readme.txt | 8 +++++++-
3 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/doc/treasures/windows/.gitignore b/doc/treasures/windows/.gitignore
index 27485e2..797128b 100644
--- a/doc/treasures/windows/.gitignore
+++ b/doc/treasures/windows/.gitignore
@@ -1 +1,2 @@
-!*.exe
\ No newline at end of file
+!*.exe
+!*.cmd
\ No newline at end of file
diff --git a/doc/treasures/windows/openhardwaremonitor-clean.cmd
b/doc/treasures/windows/openhardwaremonitor-clean.cmd
new file mode 100644
index 0000000..855fafe
--- /dev/null
+++ b/doc/treasures/windows/openhardwaremonitor-clean.cmd
@@ -0,0 +1,23 @@
+@echo off
+rem
**************************************************************************************
+rem This small script is used to solve problems with OpenHardwareMonitor section
+rem "Administrative Rights" are required
+rem
**************************************************************************************
+rem 1. If openhardwaremonitor section is absent, you may try this solution.
+rem 2. The script is relative safe: stops OHM WMI provider and clean WMI data.
+rem 3. As additional check you may also try in powershell command
+rem Get-WmiObject -Namespace "root\OpenHardwareMonitor" -Class Sensor
-Impersonation 3
+rem start powershell.exe, copy paste string above and hit Enter.
+rem If output is absent or command is hanging up, then you should try this script
+rem
**************************************************************************************
+rem Do not forget: Your Agent must be configured to provide OpenHardwareMoniotr section
+rem
**************************************************************************************
+net session 2> nul
+if %errorlevel% NEQ 0 powershell Write-Host "Administrative Rights are required to
run this Script" -Foreground Red && exit /B 1
+powershell Write-Host "Stopping Windows Agent and OpenHardwareMonitor..."
-Foreground Cyan
+net stop check_mk_agent
+taskkill.exe /F /IM OpenHardwareMonitorCLI.exe
+powershell Write-Host "Cleaning WMI..." -Foreground Cyan
+powershell.exe -command "Get-WmiObject -query \"Select * From __Namespace
Where Name='OpenHardwareMonitor'\" -Namespace \"root\" |
Remove-WmiObject"
+powershell Write-Host "Starting Windows Agent again..." -Foreground Cyan
+net start check_mk_agent
diff --git a/doc/treasures/windows/readme.txt b/doc/treasures/windows/readme.txt
index 86822bd..a059012 100644
--- a/doc/treasures/windows/readme.txt
+++ b/doc/treasures/windows/readme.txt
@@ -2,7 +2,7 @@ Assorted Windows Utilities
1. perf_reader.exe
Synopsis:
- Prevent Handle Leaks on some ( usually old ) Windows OS
+ Prevents Handle Leaks on some ( usually old ) Windows OS
Usage:
1. Create in check_mk folder subfolder "utils". For example:
mkdir "c:\Program Files (x86)\check_mk\utils"
@@ -11,3 +11,9 @@ Usage:
3. Optionally you may test functionality:
goto folder "check_mk" and run check_mk_agent perfread
Note: you may need administrative privileges.
+
+2. openhardwaremonitor-clean.cmd
+Synopsis:
+ Solves problems with OpenHardwareMonitor section.
+Usage:
+ Run the script from Windows command line as Administrator