Hello! Just sharing the code, finally I could do this although the code may not look great, it works!
😉Just change PrintServerName with your Windows print server. Adjust the TimeinQueue to fit your needs and it will keep the queue jobs clean if you schedule it on the server.
Const USE_LOCAL_TIME = True
Set DateTime = CreateObject("WbemScripting.SWbemDateTime")
strComputer = "PrintServerName"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colInstalledPrinters = objWMIService.ExecQuery ("Select * from Win32_PrintJob")
Wscript.Echo "Print Queue" & vbTab & "Job ID" & vbTab & "Submitted" & vbTab & "Total Pages"
For Each objPrinter in colInstalledPrinters
DateTime.Value = objPrinter.TimeSubmitted
dtmActualTime = DateTime.GetVarDate(USE_LOCAL_TIME)
TimeinQueue = DateDiff("n", dtmactualTime, Now)
If TimeinQueue > 1440 Then
strPrinterName = Split(objPrinter.Name,",",-1,1)
Wscript.Echo strPrinterName(0) & vbtab & vbTab & objPrinter.JobID & vbTab & dtmActualTime & vbTab & objPrinter.TotalPages
Set objWMIService1 = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colInstalledPrinters1 = objWMIService.ExecQuery _
("Select * from Win32_Printer Where Name = '" & strPrinterName(0) & "'")
For Each objPrinter1 in colInstalledPrinters1
objPrinter1.CancelAllJobs()
Next
End If
Next
Thank you for the sample code ejersen!