Get-WinEvent -FilterHashTable @{LogName="Microsoft-Windows-PrintService/Operational";} |
Format-Table -Property TimeCreated,
@{label='UserName';expression={$_.properties[2].value}},
@{label='ComputerName';expression={$_.properties[3].value}},
@{label='PrinterName';expression={$_.properties[4].value}},
@{label='PrintSize';expression={$_.properties[6].value}},
@{label='Pages';expression={$_.properties[7].value}}
I want to filter out all those lines where PrinterName is "MyPrinter" from the output of the above command
Just add a Where-Object
condition before you format the table:
Get-WinEvent -FilterHashTable @{LogName="Security";} |
Where-Object { $_.properties[4].value -eq 'MyPrinter'} |
Format-Table -Property TimeCreated,
@{label='UserName';expression={$_.properties[2].value}},
@{label='ComputerName';expression={$_.properties[3].value}},
@{label='PrinterName';expression={$_.properties[4].value}},
@{label='PrintSize';expression={$_.properties[6].value}},
@{label='Pages';expression={$_.properties[7].value}}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments