Categories

W2KSG: Log Properties

Having seen how to view the log properties lets see how we can change them. One possibility is with WMI.  Lets start by viewing the event logs

Get-WmiObject -Class Win32_NTEventLogFile

one thing to note is that the property with the log file name is LogFileName rather than name

Listing 12.4

$applog = Get-WmiObject -Class Win32_NTEventLogFile -Filter "LogFileName = 'Application'"

$applog.MaxFileSize = 26214400

$applog.psbase.Put()

Use get-wmiobject to access the log file. Set the maximum file size and use .psbase.put() to write back the change.  If you need to configure the size on a number of computers - create a csv file with the computer names then use

Import-csv | foreach{

$applog = Get-WmiObject -computername $_.Computer -Class Win32_NTEventLogFile -Filter "LogFileName = 'Application'"

$applog.MaxFileSize = 26214400

$applog.psbase.Put()

}

 

Share this post :

 

Technorati Tags: ,,

 

 

Leave a Reply