간단한 질문이지만 다음 코드에서 특정 열을 선택하려면 어떻게해야합니까?결과에 단 하나의 열만 표시합니까?
저는 TIME 열만 보여주고 싶습니다. 나는 시도하고 FORMAT_TABLE 시간에 넣어하지만 그것은 단지 실제로 시간을 표시하지 않고 시간을 여러 번으로 채 웁니다 ..
$server_event = Get-Content -Path "c:\Temp\Servers.txt"
foreach($servers in $server_event)
{
$event = Get-EventLog -computerName $servers -logname system | Where-Object {$_.EventID -eq 6009} | Select -First 1
$event
}
결과 : 만 시간 COLUMN에게 보여주고 싶은
Index Time EntryType Source InstanceID Message
----- ---- --------- ------ ---------- -------
78858 Jun 01 07:19 Information EventLog 2147489657 Microsoft (R) Windows (R) 5.02. 3790 Service Pack 2 Multiprocessor Free.
46221 Jun 01 07:20 Information EventLog 2147489657 Microsoft (R) Windows (R) 5.02. 3790 Service Pack 2 Multiprocessor Free.
214480 Jun 01 07:46 Information EventLog 2147489657 Microsoft (R) Windows (R) 5.02. 3790 Service Pack 2 Multiprocessor Free.
461238 Jun 01 07:18 Information EventLog 2147489657 Microsoft (R) Windows (R) 5.02. 3790 Service Pack 2 Multiprocessor Free.
70889 Jun 01 07:17 Information EventLog 2147489657 Microsoft (R) Windows (R) 5.02. 3790 Service Pack 2 Multiprocessor Free.
52397 Jun 01 07:19 Information EventLog 2147489657 Microsoft (R) Windows (R) 5.02. 3790 Service Pack 2 Multiprocessor Free.
42219 Jun 01 07:40 Information EventLog 2147489657 Microsoft (R) Windows (R) 5.02. 3790 Service Pack 2 Uniprocessor Free.
을 아 ........ TimeGenerated을! 그것이 나를 혼란스럽게 만든 이유입니다! C.B.라는 정확한 이름을 어떻게 찾으십니까? – lara400
또한'Get-WinEvent'를 대신 사용하십시오. 'Get-EventLog'는 [이전 버전과의 호환성] (http://technet.microsoft.com/en-us/library/hh849682.aspx)입니다 (참고 절 참조). 아, 그리고 TimeCreated가 아니라 TimeGenerated입니다. – vonPryz
이렇게하면 :'(Get-EventLog -logname system) [0] | fl *'은 단일 이벤트 로그에 대한 모든 특성 목록을 리턴합니다. 'timewritten'하지만 IIRC는 기본 powershell 형식으로 볼 수 있습니다.'Timegenerated' –