+ Post New Thread
Results 1 to 3 of 3
Scripts Thread, psexec to delete print spooler not working in Coding and Web Development; I am trying to create a script so I can quickly wipe a print spool folder and have the following ...
  1. #1

    Join Date
    Apr 2010
    Posts
    2,070
    Thank Post
    85
    Thanked 189 Times in 156 Posts
    Rep Power
    84

    psexec to delete print spooler not working

    I am trying to create a script so I can quickly wipe a print spool folder and have the following simple script:

    psexec.exe net stop "print spooler"
    psexec.exe del "x:\spool\*.*"
    psexec.exe net start "print spooler"
    pause
    I am running this on the server (will make it work remotely later) but get the following error

    psexec could not start del
    The system cannot find the file specified
    The spooler does stop and then start and I am logged in as an admin. I have triple checked the x:\spool is the correct location and even given full security to domain users on this folder.

    Any idea or alternatives

  2. #2


    Join Date
    Feb 2007
    Location
    51.403651, -0.515458
    Posts
    9,147
    Thank Post
    234
    Thanked 2,738 Times in 2,018 Posts
    Rep Power
    800
    Quote Originally Posted by edutech4schools View Post
    Any idea or alternatives
    Have you tried doing it without PSExec? e.g.

    PowerShell
    Code:
    $Spool = (Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Print\Printers").DefaultSpoolDirectory
    
    Stop-Service Spooler -Force
    
    Get-ChildItem -Path $Spool * -Recurse | Remove-Item
    
    Start-Service Spooler

    Command Prompt
    Code:
    sc stop spooler
    
    del /q /f /s "X:\Spool\*.*"
    
    sc start spooler

  3. #3

    Join Date
    Mar 2007
    Posts
    1,800
    Thank Post
    85
    Thanked 296 Times in 227 Posts
    Rep Power
    87
    Try calling cmd before del

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 17
    Last Post: 28th January 2013, 12:14 PM
  2. Help... Staff to delete Print jobs
    By timbo343 in forum Windows
    Replies: 10
    Last Post: 26th February 2010, 02:52 PM
  3. RDP to a win2003 server not working
    By FatBoy in forum Windows
    Replies: 11
    Last Post: 6th February 2008, 10:38 AM
  4. Script To Close Web Page Now Does Not Work
    By DaveP in forum Windows
    Replies: 3
    Last Post: 21st February 2007, 10:34 AM
  5. XLS to CSV not working for pupil info
    By MK-2 in forum ICT KS3 SATS Tests
    Replies: 3
    Last Post: 24th January 2007, 01:30 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
  •