天天看點

對PowerShell的執行結果進行圖形化篩選

當我們用PowerShell執行資訊搜尋時,得到大量的結果;

例如,查詢前50條日志

<a href="http://281816327.blog.51cto.com/attachment/201404/30/907015_1398865871GsN1.png" target="_blank"></a>

雖然可以通過管道和select-object/where-object進行篩選,但是不同的指令有不同的屬性和值,很難精準的記憶每一個屬性;

例如,查詢系統更新事件

<a href="http://281816327.blog.51cto.com/attachment/201404/30/907015_1398865875IST5.png" target="_blank"></a>

很明顯需要記住屬性名稱“instanceid”和相應的ID号,這樣操作起來比較繁瑣;

PowerShell中提供OUT-GRIDVIEW參數輸出圖形化結果,形似EXCEL進行篩選;

例如,查詢前50條日志:

<a href="http://281816327.blog.51cto.com/attachment/201404/30/907015_13988658799f53.png" target="_blank"></a>

(1)在彈出的圖形化的結果中,在篩選器中輸入關鍵字,即模糊的搜尋結果;

例如,查找有關更新的事件,輸入“更新”

<a href="http://281816327.blog.51cto.com/attachment/201404/30/907015_1398865887M5xC.png" target="_blank"></a>

(2)也可以添加篩選“标準“;例如,添加”EntryType“:

<a href="http://281816327.blog.51cto.com/attachment/201404/30/907015_1398865893BV6X.png" target="_blank"></a>

選擇條件:

<a href="http://281816327.blog.51cto.com/attachment/201404/30/907015_13988658973Igt.png" target="_blank"></a>

輸入關鍵字:

<a href="http://281816327.blog.51cto.com/attachment/201404/30/907015_1398865901c9B4.png" target="_blank"></a>

這樣篩選結果,是不是很簡潔友善?

本文轉自 bannerpei 51CTO部落格,原文連結:http://blog.51cto.com/281816327/1405193,如需轉載請自行聯系原作者

繼續閱讀