Deleting Old Print Spool Jobs Using A Powershell Script Bartender
We use Bartender for our sap printing purpose and we have Bartender applicaiton installed on our windows server 2008 R2 machine. This machine does lot of printing due to which loads of spool jobs will get created in C:\windows\system32\spool\Printer Folder.
I wrote one powershell script which stops the print spooler and commander service and delete these old spool files from C:\windows\system32\spool\Printer location. This worked great for few days , but now we are facing issues with printing once we execute the powershell script.
The commander service wont get started , once we execute the script . what could be the reason????
Does anyone faced this kind of issues before?
Let me know your thought.
Thanks in advance.
What exact syntax are you using for the powershell script?
Attach your Commander task list (.tl) please.
Do you get any error message when the service won't start? Does it give any useful information as to why the service cannot start, such as an error number?0
Stop-Service “Commander Service”
$Spoolers = Get-ChildItem C:\windows\system32\spool\Printers\* -recurse
foreach($Spooler in $Spoolers)
if(((get-date) - $Spooler.lastwritetime) -gt "2")
Remove-Item -Path C:\Windows\System32\spool\PRINTERS\$($Spooler.Name) -Recurse -confirm:$false
Start-Service “Commander Service”
Above is the script which I run.
I checked the eventlogs , it was showing below message.
The Commander Service service was unable to log on as .\bartender with the currently configured password due to the following error:
Logon failure: the user has not been granted the requested logon type at this computer.
Service: Commander Service
Domain and account: .\bartender
I see , Log on as service has been granted on bartender account (Local Account).
Can you try configuring the "Commander Service" under Windows Services under a different account? Perhaps a domain account with sufficient credentials?0
Lets give a try on that.
Also we see the application is getting crashing once we stop and start the commander service
Faulting application name: BarTend.exe, version: 9.40.2760.2652, time stamp: 0x4d7980a1
Faulting module name: KERNELBASE.dll, version: 6.1.7601.18229, time stamp: 0x51fb1116
Exception code: 0xe06d7363
Fault offset: 0x0000c41f
Faulting process id: 0x21dc
Faulting application start time: 0x01cf8226b626ba92
Faulting application path: C:\PROGRA~2\Seagull\BARTEN~1\BarTend.exe
Faulting module path: C:\Windows\syswow64\KERNELBASE.dll
Report Id: 619da812-ee46-11e3-879d-0050568100af
Is this nornal?
I can see that you're not running the latest service release for BT v9.4. Would you still have the same problems if you install BT v9.4 SR3? Please also make sure to upgrade the Seagull License Server as well.