Cmd to identify the driver shown in a BSoD?

I’m writing a batch script to 1) detect if the last shutdown was a crash, 2) identify the driver responsible* for the crash, and 3) perform some specific troubleshooting accordingly. I know exactly how to do Steps 1 and 3, but I don’t know where to start for Step 2. Is this information in the Event Log? Can it be found through the WinDbg cli?

*by “the driver responsible,” I specifically mean the driver named in the BSoD. This script is simply intended to automate the basic first steps I would take if I observed a BSoD.

What is the most straightforward way to programmatically query the name of the driver shown in a particular BSoD?