Get the App
SLTechnology News&Howtos  ›  Servers  › 

Use Powershell to count the number of Widnows print server users printing

Shulou Source: shulou.com Published: 2022-06-02 20:44:24 10月04日 Update

The management requirement of the company is to see which employee prints, and the solution:

First, go to the print server in Windows and start the print log. To do this, open Event Viewer and navigate to Applications and Services Logs\ Microsoft\ windows\ Print Service\ Optional

Right-click on this and select Enabled Log

The above methods can also be implemented through Powershell statements.

Get-WinEvent-ListLog Microsoft-Windows-PrintService/Operational-OutVariable PrinterLog |

Select-Object-Property LogName, IsClassicLog, IsEnabled

$PrinterLog.set_IsEnabled ($true)

$PrinterLog.SaveChanges ()

Get-WinEvent-ListLog Microsoft-Windows-PrintService/Operational-OutVariable PrinterLog |

Select-Object-Property LogName, IsClassicLog, IsEnabled

First run the first command and find that the attribute value is not enabled, then force it to be enabled by the command, and then check it again.

The following can be answered at once through this command.

Get-WinEvent-FilterHashTable @ {LogName= "Microsoft-Windows-PrintService/Operational"; ID=307; StartTime= (Get-Date). AddDays (- 1)} | 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}}

Tags: Commands that is methods servers services companies can pass employees properties situations scenarios logs answers solutions statements requirements pastries navigation enforcement check Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux MySQL macOS vpn OPPO Reno