Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

[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?

share|improve this question
    
the only way I can think to do this would be a workflow - which isn't availale until v3 –  Jim B Mar 28 '12 at 3:52
    
We have been having trouble with our network clients suddenly being unable to print. They get an odd error with a hex code >> What is the hex code We're assuming this is a bug with the latest Dell 2330dn driver since that is the only model that has this problem >> Did you try reverting to the old driver and then printing ? –  Sunny Chakraborty Sep 17 '12 at 19:36

1 Answer 1

Just because you're using PowerShell doesn't mean you can't use good old commands like sc stop/start servicename, net use, etc.

If you truly need a system restart, you'd probably need two separate scripts.

What's the problem with deleting the contents of the printer driver directory? Or did you mean something else by "file management"?

share|improve this answer
    
I do have a scripting solution since it is easy to perform the workaround. I was hoping for something that didn't rely on a delete file command. What I am looking for is a different way of clearing the print drivers. Preferably one that can allow the print spooler service to remain on. Since it locks the affected files, you can't delete them with file explorer unless you restart the computer to release the files. –  Doltknuckle Mar 28 '12 at 3:33
    
Edited question to beter match what I need. –  Doltknuckle Mar 28 '12 at 3:40
    
what is the problem with the current script? –  northben Mar 28 '12 at 14:17
    
I'd like a solution that doesn't require a reboot which is difficult to do in the middle of the day. While it is trivial to perform the action after work hours, I'd like to find a better way. –  Doltknuckle Apr 1 '12 at 20:56
2  
It's actually Explorer.exe which has the file locked. You can kill the process (which kills the windows interface) delete the file, and then relaunch explorer to bring back the windows interface. It's not a good experience for the end user if all of their windows suddenly disappear. –  Doltknuckle Oct 18 '12 at 18:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.