Как правильно читать логи windows

В Windows вы можете отслеживать использование принтеров пользователями с помощью журнала событий Windows. Все задания печати, которые отправляются на печать через Print Spooler оставляют след в логах Event Viewer. Если у вас развернут принт-сервер на Windows, вы можете использовать эти логи для организации простой системы аудита печати, которая позволяет понять кто, когда и сколько печатал на ваших принтерах.

В этой статье мы покажем, как включить и настроить логирование событий печати в Windows, как просматривать историю печати из Event Viewer, и как выполнять поиск и фильтрацию событий печати с помощью PowerShell

Содержание:

  • Включить ведение логов печати в Windows
  • Просмотр логов печати в Windows с помощью Event Viewer
  • Анализ логов печати с помощью PowerShell

Включить ведение логов печати в Windows

В Windows есть отдельный журнал Event Viewer, в который должны записываться все события печати
SystemRoot%\System32\Winevt\Logs\Microsoft-Windows-PrintService%4Operational.evt
. Но по умолчанию это журнал отключен. Чтобы включить сохранение логов печати в журнал:

  1. Откройте консоль Event Viewer (
    eventvwr.msc
    );
  2. Перейдите в раздел Applications and Services Logs -> Microsoft -> Windows -> PrintService;
  3. Щелкните правой кнопкой по журналу Operations и выберите Enable Log;
  4. Если данный хост используется как сервер печати, и вы хотите хранить логи печати за большой промежуток времени, нужно увеличить размер этого журнала событий (по умолчанию 1Мб). Откройте свойства журнала Operational и укажите максимальный размера журнала.

Также вы можете включить (отключить) определенный журнал событий в Windows с помощью команды:

wevtutil.exe sl Microsoft-Windows-PrintService/Operational /enabled:true

Если вы хотите, чтобы в журнале событий отображалось имя файла, который был отправлен на печать, нужно включить специальный параметр GPO.

  1. Откройте редактор локальной GPO (
    gpedit.msc
    );
  2. Перейдите в раздел Computer Configuration -> Administrative Templates -> Printers;
  3. Включите параметр Allow job name in event logs;
    Групповая политика: показывать имя документа в логи печати

  4. Обновите настройки политик с помощью команды
    gpupdate /force

После жэтого информация о всех событиях печати будет сохраняться в этот журнал.

Просмотр логов печати в Windows с помощью Event Viewer

Теперь вы можете получить подробную информацию о всех событиях печати, которые выполнялись на этом компьютере.

Откройте Event Viewer и перейдите в раздел Applications and Services Logs -> Microsoft -> Windows -> PrintService -> Operational. Наибольший интерес тут представляет собой событие с Event ID 307:
Printing a document

Откройте описание события:

Document 12, Microsoft Word - winitpro.docx owned by kbuldogov on \\DESKTOP-HOME607 was printed on HP LaserJet M1530 MFP Series PCL 6 through port USB001. Size in bytes: 32780. Pages printed: 1. No user action is required.

В описании события указано:

  • Из какого приложения и какой файл был напечатан: Microsoft Word — winitpro.docx
  • Имя пользователя, отправившего документ на печать: kbuldogov
  • Имя принтера: HP LaserJet M1530 MFP Series PCL 6
  • Количество страниц в документе: Pages printed: 1
  • Размер документа: size in bytes

Событие печати на принтер с кодом 307

Таким образом, вы получите инструмент ведения и просмотра истории печати в Windows.

Анализ логов печати с помощью PowerShell

Журнал событий Event Viewer не позволяет получить удобную статистику истории печати в Windows или выполнять поиск по дате/пользователю/документу. Для обработки и фильтрации событий печати можно использовать PowerShell скрипты.

Для получения событий из журнала PrintService/Operational мы будем использовать PowerShell комнадлет Get-WinEvent.

Следующий PowerShell скрипт выведет список всех документов, которые были напечатаны на этом компьютере за последние сутки (скрипт выбирает значения из атрибутов события с EventID 307):

$all2dayprint=Get-WinEvent -FilterHashTable @{LogName="Microsoft-Windows-PrintService/Operational"; ID=307; StartTime=(Get-Date).AddDays(-1)} | Select-object -Property TimeCreated, @{label='UserName';expression={$_.properties[2].value}}, @{label='Document';expression={$_.properties[1].value}}, @{label='PrinterName';expression={$_.properties[4].value}}, @{label='PrintSizeKb';expression={$_.properties[6].value/1024}}, @{label='Pages';expression={$_.properties[7].value}}
$all2dayprint|ft

PowerShell скрипт для выбора всех событий печати в Windows

Если вы хотите вывести только документы, которые распечатал определенный пользователь, используйте такой скрипт:

$PrintUsername='kbuldogov'
$all2dayprint| Where-Object -Property UserName -like $PrintUsername|ft

Можно выгрузить список напечатанных документов в CSV файл с помощью Export-CSV:

$all2dayprint | Export-Csv -Path "c:\ps\Print Audit.csv" –NoTypeInformation -Encoding UTF8

Или представить его в виде графической формы Out-GridView:

$all2dayprint| Out-GridView -Title "Все события печати"

PowerShell: найти все документы, которые отправил на печать пользователь Windows

Можно запланировать этот PowerShell скрипт на ежедневный запуск и писать информацию об использовании принтеров во внешнюю базу данных.

This post explains how to check Print History in Windows 11. When you print a document using your Windows 11/10 laptop or PC, it doesn’t keep track of it by default. However, if you want, you can enable Windows to save the print history so that you may refer to it later. This can be done by enabling the printer’s print queue to remember printed documents, or by configuring the Event Viewer to record all print events. A few third-party software also allow you to monitor the print activity on your system and view the list of documents that have been printed in the past. In this article, we will explain in detail how you can keep a log of the printed documents and check the print history in Windows 11.

How to check Print History in Windows 11

You can check the Print History to know which documents or files have been printed from your system with or without your knowledge. You can also use it to crosscheck if you’ve already printed a document, or how many documents you print on monthly basis to keep a track of the inventory.

In Windows 11, you can check the Print History using the following methods:

  1. Using Printer Settings
  2. Using Event Viewer
  3. Using third-party print logging software

Let us see these in detail.

1] Check Print History using Printer Settings

Enable Print History in Printer Settings

You can check the print queue to see which documents are currently being printed and what are the upcoming print jobs. However, once the document is printed, its record gets deleted from the printer’s print queue. In order to save this record and see which documents have been printed in past, you need to manually enable the ‘Keep printed documents’ option in Windows 11.

  • Click on the Start button icon in your taskbar area.
  • Select Settings.
  • Click on Bluetooth & devices in the left panel.
  • Then click on Printers & scanners in the right panel.
  • Select a printer from the list of available devices.
  • Open Printer properties.
  • Within the Printer properties window, switch to the Advanced tab.
  • Select the checkbox corresponding to the Keep printed documents option.
  • Click on the OK button.

This will enable the Printer’s print queue to remember the print history. If your system is connected to multiple printers on a local or shared network, you will have to enable this option separately for each of the connected printers.

To view the print history, select Start > Settings > Bluetooth & devices >Printers & scanners and then select the printer in the list of available devices. Then click on the Open print queue option. You will be able to view your print history in the printer’s print queue.

View Print Queue log in Windows

A printer’s print queue has limited space, so it keeps replacing the existing records with new records whenever the data of the print log goes beyond its capacity. By using this method, you will be able to see the history of print jobs for a limited period of time. If you want to maintain a long-term log of your print history, you should use the next method.

Read: How to enable Print Logging in Event Viewer on Windows

2] Check Print History using Event Viewer

Check Print History using Event Viewer in Windows

Event Viewer is a Windows application that keeps a log of everything that happens on your system right from the moment it starts till it shuts down. You may use it as a troubleshooting tool to see errors and warnings generated by different apps and software installed on your system. If you want, you can configure it to remember the print history on your Windows 11 device.

  • Right-click on the Start button icon to open the WinX menu.
  • Select the Event Viewer option.
  • In the Event Viewer window, navigate to the following path: Applications and Services Logs\Microsoft\Windows\PrintService.
  • In the right panel, right-click on the Operational option.
  • Then select the Properties option from the context menu.
  • In the Log Properties window that appears, select the checkbox corresponding to the Enable logging option. You may also specify the maximum log size and choose what your system should do when the maximum event log size is reached (overwrite events, archive log, clear logs manually).
  • Click on the Apply button.
  • Then click on the OK button.

From now onwards, Windows Event Viewer will keep a log of your printed documents. To view this log, navigate to Applications and Services Logs/Microsoft/Windows/PrintService. Then in the right panel, double-click on the Operational option. Now you will be able to see the event log for print jobs issued from your system.

Also Read: Deleted Printer keeps reappearing & coming back in Windows.

3] Check Print History using third-party print logging software

Check Print History using PaperCut Print Logger

A few third-party tools also allow you to view print history on Windows 11. PaperCut Print Logger is one such free tool that you may install in your system to keep a track of the documents printed from your system. It shows useful information such as the time of print, the user who issued the print command, the document name or title, the total number of pages in the document, and other print job attributes such as paper size, print mode, etc.

Download PaperCut Print Logger free. Double-click on the downloaded file to run the installer. Follow the on-screen instructions to install the software.

Once Print Logger is installed, it will sit in the background and monitor all the print activities on your Windows 11 PC. It can also monitor printing on network printers if it is installed on a server that hosts the print queues.

To check the Print History, open File Explorer and navigate to the location where you’ve installed the software. By default, it is C:\Program Files (x86)\PaperCut Print Logger. Now double-click on the ViewLogs shortcut. This will open a webpage in your preferred web browser detailing all the print activities that have occurred in your system since Print Logger was installed. You can also create a desktop shortcut for easy access to the print log.

If you want, you can prevent Print Logger from monitoring a specific printer by adding the printer’s name in the IgnoredPrinters setting in its configuration file, which is located at C:\Program Files (x86)\PaperCut Print Logger\papercut-logger.conf.

Apart from Print Logger, there are several other third-party software that you may install to view Print History in Windows 11.

I hope you find this useful.

Read Next: How to see Recently Opened Files in Windows.

Quick Links

  • Enable Printer History Logging for Recently Printed Documents on Windows 10

  • Enable Printer History Logging for Recently Printed Documents on Windows 11

  • Enable Long-Term Print History in Event Viewer.

  • View Print History in Event Viewer

  • Use Third-Party Print Logging Software

Checking the history of a printer to see what was printed can be somewhat difficult to monitor. As your toner level doesn’t convey how much the accessory has been used, you’ll need to enable logging within Windows 10 or Windows 11. Here are a few ways to do that.

Enable Printer History Logging for Recently Printed Documents on Windows 10

By default, your printed document history will be wiped after each document has finished printing. You can change this setting to enable you to see a list of your recently printed documents from the print queue for your printer. You’ll need to change this setting for each printer you have installed.

Access Your Print Queue to Enable Logging

To access your print queue, right-click the Windows Start menu button and select the «Settings» option. From here, click Devices > Printers & Scanners.

Access your Windows printer settings by right-clicking your Start Menu button, clicking Settings, then Devices > Printers & Scanners

Find your printer in the «Printers & Scanners» list, click on it, and then click «Open Queue» to open the print queue.

Click on your printer and click Open Queue to open the printer queue

Your printer queue with current and queued printed items will be listed. Documents you’ve previously printed will not be shown, which is why you’ll need to enable logging.

In the print queue window for your printer, click Printer > Properties. Alternatively, select your printer and click «Manage» in the «Printers & Scanners» settings menu.

Click Printer > Properties in the print queue for your printer» src=»https://static1.howtogeekimages.com/wordpress/wp-content/uploads/2019/10/Print-Queue-Properties-Button.png»></p>
<div class= Картинка с сайта: www.howtogeek.com

In your printer properties, click on the «Advanced» tab and then select the «Keep Printed Documents» checkbox.

Click «OK» to save your settings.

Click the advanced tab in your printer settings and enable the keep printed documents checkbox

Once your document history is enabled, your documents will no longer disappear from your print queue after the printing process has completed.

Enable Printer History Logging for Recently Printed Documents on Windows 11

Windows 11 doesn’t enable a print history by default, much like its predecessor. To enable a short-term print history, press Windows+i or otherwise open the Settings app, then navigate to Bluetooth & Devices > Printers & Scanners, then select your printer.

Scroll down and then click «Printer Properties.»

Click or tap 'Printer Properties.'

Select the «Advanced» tab, tick the box next to «Keep Printed Documents,» then click «Apply.» You can then close all the windows.

The 'Advanced' tab in Printer Properties.

Whenever you want to review your print history, all you need to do is open to Settings > Bluetooth & Devices > Printers & Scanners, select your Printer, then click «Open Print Queue.»

Enable Long-Term Print History in Event Viewer.

The print queue will provide a short-term overview of your previously printed documents. If you want to view a long-term list, you’ll need to use the Windows Event Viewer.

To start, right-click your Windows Start menu button and click the «Event Viewer» option.

Open the Event Viewer through the Power User Menu.

The Event Viewer will allow you to view a list of previously printed files, but you’ll need to set Windows to begin logging your long-term printer history first. In the Windows Event Viewer, click Applications and Services Logs > Microsoft > Windows in the «Event Viewer (Local)» menu on the left.

In Event Viewer, click Applications and Services Logs &gt; Microsoft &gt; Windows.

This will reveal a significant number of Windows services. Scroll down to find the «PrintService» category.

From here, right-click the «Operational» log and then click the «Properties» button.

properties

Click to enable the «Enable Logging» checkbox and then set a maximum size for the log. The larger the size, the longer Windows will record your printed document history.

Click the «Apply» button to save the setting.

Tick the box next to 'Enable Logging,' set the log size you want, then click 'Apply.'

Windows will now automatically save the printer history for all of your installed printers to a log file that you can access within Event Viewer.

View Print History in Event Viewer

Once your printer history is enabled, you can access it at any time from the Event Viewer. To do so, find and open the «PrintService» category and then click on the «Operational» log.

In Event Viewer, click 'PrintService', then click Operational

A history of all Windows printer events will be listed, from initial printer spooling to completed or failed prints.

Under the «Task Category» section, items listed as «Printing a Document» are documents that have been successfully printed. Failed prints will also appear in this category.

The PrintService Operational log will list your printed document history

To make it easier to sort, you can group your print log by categories, making it easy to separate the «Printing a Document» events into their own section. To do so, right-click the «Task Category» heading and then click the «Group Events by This Column» button.

In the Event Viewer logs list, right-click Task Category, then click Group Events by This Category

Your items will now be separated by category.

You can minimize the other categories, leaving the «Printing a Document» category to display only a list of your previously printed documents.

A list of printed documents in the Event Viewer, separated by categories

Use Third-Party Print Logging Software

While the Event Viewer is functional, it doesn’t provide the clearest view of your printed documents. You can use third-party print logging software like PaperCut Print Logger to view your long-term printer history instead.

PaperCut Print Logger provides you with a time-stamped list of your printed documents, including information on the Windows user who printed the document, the document name, and the number of pages and copies.

An example of a print log within the PaperCut Print Logger admin page

The admin page can be accessed from the default PaperCut Print Logger directory.

On Windows 10, this is usually C:\Program Files (x86)\PaperCut Print Logger . Double-click the «ViewLogs» shortcut to open the admin panel, where a list of your printed documents will be available, separated by date.

In the PaperCut installation directory, double-click the ViewLogs shortcut

Once you’ve opened the PaperCut Print Logger admin page, under the «View» category, click the «HTML» button to access your print history for that date within the panel.

You can also click the «CSV/Excel» button under the «Date (Day)» or «Date (Month)» categories to export your daily or monthly print history as a Microsoft Excel XLS file.

An example of the PaperCut admin page

You can also access these logs from the Logs > CSV folder inside your PaperCut Print Logger installation directory.

From time to time we get questions about how to read Windows Event Logs to understand what’s going on with a print system. Occasionally we might also ask customers to gather these logs to help us get a fuller understanding of what might be going wrong.

Admittedly, these logs are very granular and not easy for people to read. If you’re simply looking for a simple way to see and understand what people are printing, then you might be interested in PaperCut NG.

If you’re here for a reason and you know what you’re doing, then read on…

The Print Service Admin Log

The Print Service Admin Log shows events related to the management of print queues like Sharing printers and installing print drivers, so it can be useful when trying to understand when a printer did not install correctly. This log is enabled by default.

To download the Admin log…

  1. On the affected Windows system (this could be either the client or server), open Event Viewer by pressing Windows key + R, then type eventvwr.msc and hit the enter key.

  2. Expand Applications and Services, then Microsoft, Windows, and PrintService.

  3. Right-click on the Admin log and click Save All Events As.

  4. Choose the Event Files (*.evtx) format, and save the file

The Print Service Operational Log

The Print Service Operational log shows events related to printing documents. It is off by default, but below we explain how to enable this log and how to read it.

To download the Operational log…

  1. On the affected Windows system (this could be either the client or server), open Event Viewer by pressing Windows key + R, then type eventvwr.msc and hit the enter key.

  2. Expand Applications and Services, then Microsoft, Windows, and PrintService.

  3. Right click on the Operational log and select Enable log to start logging print jobs.

  4. Reproduce the issue you are trying to troubleshoot.

  5. Return to this area and save the Operational logs by right-clicking on the Operational log and click Save All Events As.

  6. Choose the Event Files (*.evtx) format, and save the file.

Tracking a typical print job…

Now that we know how to find the logs, what should a typical job look like in the Operational logs?

There will generally be 7–8 events for each job… In versions of PaperCut prior to v19.1, you would see two event 308 happen twice. Around that time we changed the way the job is paused for analysis so now there is only one event 308.

800,Print job diagnostics,Spooling job 42.
308,Printing a document,"Document 42, Print Document owned by TestUser was paused on PaperCut Global PostScript. This document will not print until the document owner resumes the print job. No user action is required."
309,Printing a document,"Document 42, Print Document owned by TestUser was resumed on PaperCut Global PostScript. No user action is required."
801,Print job diagnostics,Printing job 42.
842,Isolating printer drivers and other plug-ins,"The print job 42 was sent through the print processor winprint on printer PaperCut Global PostScript, driver PaperCut Global PostScript, in the isolation mode 1 (0 - loaded in the spooler, 1 - loaded in shared sandbox, 2 - loaded in isolated sandbox). Win32 error code returned by the print processor: 0x0."
805,Print job diagnostics,Rendering job 42.
307,Printing a document,"Document 42, Print Document owned by TestUser on \\PrintSRV01 was printed on PaperCut Global PostScript through port nul.  Size in bytes: 4597660. Pages printed: 1. No user action is required."

What other types of events are there?

Event 812 “The print spooler failed to delete the file….”

This event, found in the Operational log, pops up in totally normal print environments and sometimes causes admins concern. This refers to a scheduling file (SHD) that the Print Spooler uses to track the job and can happen with or without PaperCut. It is completely safe to ignore. You can read more on Microsoft’s Technet about PrintService EventID 812.

Event 310 “Print Document owned by user was deleted”

This event, found in the Operational log, occurs when the print job was cancelled by the user or by another application (other than PaperCut). Look at the “User” field on the event to see what user or account cancelled the job. When PaperCut cancels or deletes jobs, it calls a different method used by the Windows Print Spooler API that will not trigger this event.

Event 372 “Job rendering error”

This event, found in the Admin log, is usually associated with print jobs that fail to print or “disappear”.

We’ve seen a few different causes for this, for example, it can happen…

  • When macOS computers print to Shared Windows queue which is configured to use Type-4 drivers.
  • In a Find-Me Printing scenario when the source and destination print queues are configured for different data types, as described in our article Troubleshooting Disappearing jobs with Find-Me Printing.
  • When a PaperCut Mobility Print queue on a user’s workstation is manually configured to use a Type-4 driver instead of the default PaperCut Global PostScript driver (not common). This generates a RAW-format print jobs, but the Type-4 print driver on the server may cancel this job if it expects an XPS-formatted print job. We’ve tried but can’t explain this any easier, so just stick to Type-3 drivers.

Event 512 “Initializing a print provider error”

This event, found in the Admin log, is usually associated to client systems with machine names greater than 15 characters when the print system fails to load inetpp.dll. The result is a print failure for any printer configured to submits jobs to a Windows “Internet Port”. For PaperCut, this means Mobility printers and the “PaperCut Printer” used for PaperCut Pocket and Hive.

Changing the client machine name to 15 characters will allow Windows to reliably load this binary.


Still have questions?

Let us know! We love chatting about what’s going on under the hood. Feel free to leave a comment below or visit our Support Portal for further assistance.

In Windows, you can track printer usage with the Event Viewer. All print jobs sent to the print spooler are logged in the Event Viewer. If you have a print server deployed on Windows, you can use these logs to organize a simple print audit solution that enables you to understand who has printed on your printers, when, and how many pages.

In this article, we will show how to enable and configure print event logging in Windows, view print history in the Event Viewer, and search or filter print events with PowerShell.

Contents:

  • How to Enable Print Logging in Windows
  • Checking Print History on Windows Using Event Viewer
  • Print Logs Analysis with PowerShell

How to Enable Print Logging in Windows

Windows has a separate Event Viewer log where all printing events are logged: SystemRoot%\System32\Winevt\Logs\Microsoft-Windows-PrintService%4Operational.evt. However, this log is disabled by default. To enable print logging on Windows:

  1. Open the Event Viewer (eventvwr.msc);
  2. Go to Applications and Services Logs -> Microsoft -> Windows -> PrintService.
  3. Right-click the Operational and select Enable Log;
  4. Increase the size of this event log from the default of 1MB if you want to keep print logs for a long time. Open Operational log properties and set the maximum log size;

You can also enable (disable) a specific event log with the command:

wevtutil.exe sl Microsoft-Windows-PrintService/Operational /enabled:true

You must enable a special GPO setting if you want the event log to show the file name sent for printing.

  1. Open the Local Group Policy Editor (gpedit.msc);
  2. Go to Computer Configuration -> Administrative Templates -> Printers.
  3. Enable the option Allow job name in event logs;
  4. Update policy settings using gpupdate /force command.

Now all print events will be logged in the Event Viewer.

Checking Print History on Windows Using Event Viewer

You can now see detailed information about all printing events that have occurred on this computer.

Open the Event Viewer and go to Applications and Services Logs -> Microsoft -> Windows -> PrintService -> Operational. Find the event with Event ID 307: Printing a document.

Open the event details:

Document 12, Microsoft Word - woshub.docx owned by maxadm on \\DESKTOP-PC617 was printed on HP LaserJet M1530 MFP Series PCL 6 through port USB001. Size in bytes: 31780. Pages printed: 1. No user action is required.

The event description contains:

  • The name of the print file and the application from which it was printed: Microsoft Word — woshub.docx
  • The name of the user who printed the file: maxadm
  • The printer name: HP LaserJet M1530 MFP Series PCL 6
  • Number of pages printed: Pages printed: 1
  • The file size: size in bytes

Audit printing events in Windows Event Viewer

Print Logs Analysis with PowerShell

The Event Viewer does not allow to get convenient statistics of print history or search by date/user/document. You can process and filter print events using PowerShell.

To get events from the PrintService/Operational log, use the Get-WinEvent PowerShell cmdlet. The following PowerShell script displays a list of all documents that have been printed on the current computer in the last 24 hours:

$all2dayprint=Get-WinEvent -FilterHashTable @{LogName="Microsoft-Windows-PrintService/Operational"; ID=307; StartTime=(Get-Date).AddDays(-1)} | Select-object -Property TimeCreated, @{label='UserName';expression={$_.properties[2].value}}, @{label='Document';expression={$_.properties[1].value}}, @{label='PrinterName';expression={$_.properties[4].value}}, @{label='PrintSizeKb';expression={$_.properties[6].value/1024}}, @{label='Pages';expression={$_.properties[7].value}}
$all2dayprint|ft

PowerShell: list print history on Windows

If you only want to display documents that a particular user has printed:

$PrintUsername='maxadm'
$all2dayprint| Where-Object -Property UserName -like $PrintUsername|ft

You can export a list of printed documents into a CSV file using Export-CSV:

$all2dayprint | Export-Csv -Path "c:\ps\Print Audit.csv" –NoTypeInformation -Encoding UTF8

Or view it in a graphical Out-GridView form:

$all2dayprint| Out-GridView -Title "All print jobs"

View Windows print statistics with PowerShell

You can schedule this PowerShell script to run daily and write printer usage information to an external database.

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Windows server 2012 r2 standard описание
  • Зафиксировать окно поверх всех окон windows 10
  • Windows не удалось выполнить форматирование
  • Как отключить автоматический поиск обновлений windows 10
  • Сборки windows 7 all in one от sergei strelec