본문 바로가기

Server Story..../Windows Server

Windows Event 내용 긁어 오고 싶을때. 혹은 특정 값만 가져오고 싶을때


이벤트 로그 의 내용 을 파워쉘로 긁어 오려면 
get-eventlog -log Application -source MSSQLSERVER -newest 1

처럼 해야 하며,  

해당 내용중 특정 필드 값만 을 가져오려면.. 이렇게...

$a=get-eventlog -log Application -source MSSQLSERVER -newest 1
 $a | format-list -property message

근데 

해당 값에 대한 속성값을 다 보고싶을땐.

 $a | format-list -property *  

요렇게.. 하면 된다..


다른 참고는 아래내용 참조..

http://technet.microsoft.com/ko-KR/library/dd315250.aspx
 


C:\Users\Administrator>PowerShell.exe "set-executionpolicy remotesigned ; $a=get
-eventlog -log Application -source MSSQLSERVER -newest 1 ;$b=$a | format-list -p
roperty eventid ; $b|format-list > c:\1.txt"

해당 변수를 txt 파일에 넣기.