Driver Update Checker (Stale Driver Detector)
This utility scans your Windows system for installed drivers and identifies those that are potentially outdated based on their release date. While it cannot directly fetch updates from every vendor (which requires a massive database), it helps you pinpoint which hardware components might need attention.
Modules Used:
wmi: Windows Management Instrumentation wrapper to access system driver information.datetime: To calculate the age of the drivers.
Installation
This script is designed for Windows.
pip install wmi
The Code
Save this as driver_check.py.
import wmi
import datetime
import sys
def get_driver_date(wmi_date_str):
"""Converts WMI datetime string (YYYYMMDDHHMMSS...) to Python datetime object."""
if not wmi_date_str:
return None
try:
# We only care about the YYYYMMDD part
return datetime.datetime.strptime(wmi_date_str.split('.')[0], "%Y%m%d%H%M%S")
except ValueError:
return None
def scan_drivers(months_old=12):
print("Initializing WMI (Windows Management Instrumentation)...")
try:
c = wmi.WMI()
except Exception as e:
print(f"Error: Could not connect to WMI. {e}")
return
print("Scanning installed drivers... (This may take a few seconds)")
# Win32_PnPSignedDriver contains information about signed drivers
try:
drivers = c.Win32_PnPSignedDriver()
except Exception as e:
print(f"Error querying drivers: {e}")
return
print(f"\n{'Device Name':<45} {'Date':<12} {'Version':<15}")
print("-" * 75)
outdated_count = 0
now = datetime.datetime.now()
for driver in drivers:
if not driver.DeviceName or not driver.DriverVersion or not driver.DriverDate:
continue
driver_date = get_driver_date(driver.DriverDate)
if not driver_date:
continue
# Calculate age in days
age_days = (now - driver_date).days
# Check if older than threshold (approx 30 days per month)
if age_days > (months_old * 30):
outdated_count += 1
date_str = driver_date.strftime("%Y-%m-%d")
# Truncate long names
name = driver.DeviceName
if len(name) > 42:
name = name[:42] + "..."
print(f"{name:<45} {date_str:<12} {driver.DriverVersion:<15}")
print("-" * 75)
print(f"Scan Complete.")
print(f"Found {outdated_count} drivers older than {months_old} months.")
if __name__ == "__main__":
scan_drivers()
Usage
python driver_check.py
This will list all drivers older than 1 year (default). You can modify the months_old parameter in the code to change the sensitivity.