Jump to content

Recommended Posts

Posted

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

Posted
Any idea or alternatives

Have you tried doing it without PSExec? e.g.

 

PowerShell

$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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...