Skip to main content


Splunk Lantern

Print spooler adding a printer driver

You might need to search for a print spooler adding a printer driver when doing the following:


In order to execute this procedure in your environment, the following data, services, or apps are required:


Some attacks such as PrintNightmare use the print spooler to load printer drivers by utilizing the Windows PrintService operational logs using event code 316. This search detects instances of this taking place.

To optimize the search shown below, you should specify an index and a time range.

  1. Ensure PrintService Admin and Operational logs are being logged to Splunk from critical or all systems.
  2. Run the following search:
EventCode=316 category = "Adding a printer driver" Message = "*kernelbase.dll,*" Message = "*UNIDRV.DLL,*" Message = "*.DLL.*" 
| stats count min(_time) AS firstTime max(_time) AS lastTime BY OpCode EventCode ComputerName Message 

Search explanation

The table provides an explanation of what each part of this search achieves. You can adjust this query based on the specifics of your environment.

Splunk Search Explanation
source="WinEventLog:Microsoft-Windows-PrintService/Operational" Search Windows PrintService operational data.
EventCode=316 Search for entries logged to the PrintService admin.
category = "Adding a printer driver" Message IN ( "*kernelbase.dll,*" ,"*UNIDRV.DLL,*", "*.DLL.*")

Search for message values that include the given strings.

| stats count min(_time) AS firstTime max(_time) AS lastTime BY OpCode EventCode ComputerName Message Returns values for the first and last times these events occurred, sorting by OpCode and the rest of the fields shown.


Ensure you filter for false positives on this search. 

During triage, isolate the endpoint and review for source of exploitation. Capture any additional file modification events.

If your results indicate an attack has occurred, the host or computer where the vulnerability is detected needs to be further investigated and remediated according to your response plan. This involves a final step of re-imaging the system with a known good system build after investigation.