Skip navigation

JSI Tip 8218. How do I configure WMI logging on Windows XP?

To configure a WMI error log, I have scripted WMIerr.bat.

The syntax for using WMIerr.bat is:

WMIerr LogLevel LogFolder LogSize

Where:

LogLevel  is 0 to turn off logging, a 1 to turn on logging, and a 2 for verbose logging.

LogFolder is the folder where the log file will be written.

LogSize   is the maximum size of the log file.
NOTE: When a log file reaches the maximum size, it is backed up to <FileName>.lo_, and a new <FileName>.log is created. The only exception to this rule is the Framework.log file, which continues to grow.

WMIerr.bat contains:

@echo off
If \{%3\}==\{\} @echo Syntax: WMIerr LogLevel LogFolder LogSize&goto :EOF
setlocal
set LogLevel=%1
set LogFolder=%2
set LogSize=%3
set LogFolder=%logFolder:"=%#
set LogFolder=%logFolder:\#=%
set LogFolder=%logFolder:#=%set LogFolder=%logFolder:\=\\%
(
 @echo REGEDIT4
 @echo/
 @echo \[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WBEM\CIMOM\]
 @echo "Logging"="%LogLevel%"
 @echo "Logging Directory"="%LogFolder%"
 @echo "Log File Max Size"="%LogSize%"
 @echo/
) >"%TEMP%\WMIerr.reg"
regedit /s "%TEMP%\WMIerr.reg"
del /q "%TEMP%\WMIerr.reg"
endlocal



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish