+ Post New Thread
Results 1 to 8 of 8
Scripts Thread, script or batch file to stop printer spool service, delete spool files, restart servi in Coding and Web Development; Hi, On of my schools is having major issues with print jobs getting stuck in the spool folder, see this ...
  1. #1

    Join Date
    Apr 2010
    Posts
    2,052
    Thank Post
    83
    Thanked 188 Times in 155 Posts
    Rep Power
    84

    script or batch file to stop printer spool service, delete spool files, restart servi

    Hi,
    On of my schools is having major issues with print jobs getting stuck in the spool folder, see this post for info: Printers causing me no end of problems for the moment I need to find a way to let the staff fix the issue as it happens and think some kind of script would be best, although open to suggestions.

    I need to create a script that allows a user to stop the spools service running on the server, delete all files in the spool folder and then restart the spool service.

    I have no idea how I would create this, so thanks for any help.

  2. #2
    themightymrp's Avatar
    Join Date
    Dec 2009
    Location
    Leeds, West Yorkshire
    Posts
    1,219
    Thank Post
    216
    Thanked 226 Times in 195 Posts
    Rep Power
    73
    You need to get a copy of the psexec.exe program (can't remember where from but its free - google it)

    batch file rough outline:

    Code:
    pathtopsexec\psexec.exe servername net stop "print spooler"
    pathtopsexec\psexec.exe servername del c:\windows\system32\spools\printers\*.*"
    pathtopsexec\psexec.exe servername net start "print spooler"
    Something like that might work - you may need to allow the users some more permissions though as I doubt their accounts will be able to do that on a server

  3. Thanks to themightymrp from:

    edutech4schools (12th July 2012)

  4. #3

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    16,050
    Thank Post
    888
    Thanked 1,728 Times in 1,491 Posts
    Blog Entries
    12
    Rep Power
    453
    Quote Originally Posted by themightymrp View Post
    You need to get a copy of the psexec.exe program (can't remember where from but its free - google it)

    batch file rough outline:

    Code:
    pathtopsexec\psexec.exe servername net stop "print spooler"
    pathtopsexec\psexec.exe servername del c:\windows\system32\spools\printers\*.*"
    pathtopsexec\psexec.exe servername net start "print spooler"
    Something like that might work - you may need to allow the users some more permissions though as I doubt their accounts will be able to do that on a server
    To use psexec they will need to be local admins on the server.

  5. Thanks to FN-GM from:

    edutech4schools (12th July 2012)

  6. #4
    themightymrp's Avatar
    Join Date
    Dec 2009
    Location
    Leeds, West Yorkshire
    Posts
    1,219
    Thank Post
    216
    Thanked 226 Times in 195 Posts
    Rep Power
    73
    Quote Originally Posted by FN-GM View Post
    To use psexec they will need to be local admins on the server.
    Yeah its not an ideal fixit. It would obviously be better to fix the actual problem rather that patch it up like this. Think I will re-read the linked thread and try and come up with something else

  7. Thanks to themightymrp from:

    edutech4schools (12th July 2012)

  8. #5

    Join Date
    Apr 2010
    Posts
    2,052
    Thank Post
    83
    Thanked 188 Times in 155 Posts
    Rep Power
    84
    thanks for the info. Agree its not a good fix but I am only at the school once a week and have been remotely fixing the spooler 3 or more times each day.

  9. #6
    ricki's Avatar
    Join Date
    Jul 2005
    Location
    uk
    Posts
    1,475
    Thank Post
    20
    Thanked 164 Times in 157 Posts
    Rep Power
    52
    HI

    It will be a driver I am sure. Have you installed another printer recently and this has just started.

    Richard

  10. #7

    Join Date
    Apr 2010
    Posts
    2,052
    Thank Post
    83
    Thanked 188 Times in 155 Posts
    Rep Power
    84
    It will be a driver I am sure. Have you installed another printer recently and this has just started.
    Recently changed the server and all printers from HP to Dell, but still have the same issue.

  11. #8

    Join Date
    Apr 2010
    Posts
    2,052
    Thank Post
    83
    Thanked 188 Times in 155 Posts
    Rep Power
    84
    I am getting PsExec could not start Del on server using the script.

    Any ideas.

    pathtopsexec
    \psexec.exe
    servername
    net stop "print spooler"
    pathtopsexec\psexec.exe servername del c:\windows\system32\spools\printers\*.*" pathtopsexec
    \psexec.exe
    servername
    net start "print spooler"

SHARE:
+ Post New Thread

Similar Threads

  1. Batch File to Shell Script
    By juanlansang in forum How do you do....it?
    Replies: 2
    Last Post: 26th April 2012, 04:34 AM
  2. Replies: 17
    Last Post: 19th March 2012, 05:49 PM
  3. Replies: 9
    Last Post: 9th February 2012, 01:15 PM
  4. Help with beginner script/batch file to rename Program File?
    By El_Nombre in forum How do you do....it?
    Replies: 3
    Last Post: 23rd June 2011, 02:05 PM
  5. dos batch file to whs script
    By davidm in forum Windows
    Replies: 3
    Last Post: 26th March 2009, 09:37 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •