Purge print driver cache on windows 7 with powershell script

Posted by Doltknuckle on Server Fault See other posts from Server Fault or by Doltknuckle
Published on 2012-01-20T17:23:32Z Indexed on 2012/03/28 5:33 UTC
Read the original article Hit count: 480

Filed under:
|
|
|

[Background]

We have been having trouble with our network clients suddenly being unable to print. They get an odd error with a hex code. We determined that something in the driver was messed up and we could resolve the issue by clearing the driver cache and reinstalling the driver. This happens to random computers every so often. We're assuming this is a bug with the latest Dell 2330dn driver since that is the only model that has this problem.

[Problem]

What we are looking to do is write a Powershell script that would clear the driver cache and redownload the driver. I see a ton of scripts out there to manage queues, servers, and ports, but nothing for local driver cache management.

[Current Workaround]

Since we have to do this manually, I'll write out the steps so you know what we want this script to replicate.

  1. Disable print spooler
  2. Restart machine
  3. Delete contents of: C:\windows\system32\spool\drivers\w32x86
  4. Enable print spooler and start service.
  5. Delete the network printer object and re-add network printer off of server.

[Request]

I'm good enough with powershell to translate the above workaround into a pair of scripts. I'd like to find a more elegant solution then my current workaround.

Any suggestions?

© Server Fault or respective owner

Related posts about Windows

Related posts about powershell