Win32_NTEventlogFile

To get a list of log files available on your local computer:

Get-WmiObject -class Win32_NTEventlogFile | Format-Table –wrap

 

To access the log files on a remote computer:

Get-WmiObject -computerName RemoteHostName -class Win32_NTEventlogFile | select FileSize, LogfileName, Name, NumberOfRecords, CSName | Format-Table –wrap

 

To get a list of the log files that contain the last 100 entries on the local computer:

Get-WmiObject –namespace root\CIMV2 -class Win32_NTLogEvent | Select-Object LogFile –last 100 -unique

 

To get a list of log files that contain the last 100 entries on the remote computer:

Get-WmiObject –computerName RemoteHostName –namespace root\CIMV2 -class Win32_NTLogEvent | Select-Object LogFile –last 100 –unique

 

To Increase the value of MemoryPerHost when encounterring the error "Quota violation":

1. Select Start => Run and type wbemtest.exe.
2. Click Connect on theWindows Management Instrumentation Tester.
3. In the Namespace text box, just enter root. Click Connect.
4. Select Enum Instances.

5. In the Class Info dialog, enter the superclass name as __ProviderHostQuotaConfiguration
and click OK.
6. In the Query Result window, double-click _ProviderHostQuotaConfiguration=@.
7. In the Object Editor window, under Properties, find the property MemoryPerHost and double-click it.
8. Increase the value and select Save Property. Close the windows and restart the machine.

 

To query all of the entries in the Application event log:

Get-WmiObject -namespace root\CIMV2 -class Win32_NTLogEvent -filter "LogFile='Application'"

Get-WmiObject -namespace root\CIMV2 -query "Select * from Win32_NTLogEvent where LogFile='Application'"

 

To see all the properties of instances of the Win32 NTLogEvent class:

Get-WmiObject -namespace root\CIMV2 -class Win32_NTLogEvent | Select-Object -last 1 | Get-Member –MemberType Property

 

To find all the types of events available in the Application event log on the local computer by querying EventType and type:

Get-WmiObject -namespace root\CIMV2 -class Win32_NTLogEvent -Filter "LogFile='Application'" | Select-Object EventType, Type -unique | Sort-Object EventType

 

To look at the error events generated by the default SQL Server instance in the Application log:

Get-WmiObject -namespace root\CIMV2 -class Win32_NTLogEvent | Where-Object { ($_.LogFile -eq 'Application') -and ($_.SourceName -eq "MSSQLSERVER") -and ($_.EventType -eq 1) } | Format-List SourceName, Message, TimeGenerated 

 

To filter events based on date ranges:

Get-WmiObject -namespace root\CIMV2 -class Win32_NTLogEvent -Filter "LogFile='Application'" | Where-Object { ($_.EventType -eq 1) –and ($_.TimeGenerated -gt "20111130") -and ($_.TimeGenerated –lt "20111201") } | Sort-Object TimeGenerated -descending | Format-List

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值