+ 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
    Thank Post
    Thanked 192 Times in 159 Posts
    Rep Power

    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"
    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
    51.403651, -0.515458
    Thank Post
    Thanked 2,967 Times in 2,182 Posts
    Rep Power
    Quote Originally Posted by edutech4schools View Post
    Any idea or alternatives
    Have you tried doing it without PSExec? e.g.

    $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
    sc stop spooler
    del /q /f /s "X:\Spool\*.*"
    sc start spooler

  3. #3

    Join Date
    Mar 2007
    Thank Post
    Thanked 326 Times in 246 Posts
    Rep Power
    Try calling cmd before del

+ Post New Thread

Similar Threads

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