‎05-07-2008 12:39 AM
cmd.exe /K cscript \\SERVER\SHARE\show_print_queues_time.vbs {computer}
Const USE_LOCAL_TIME = True
Set DateTime = CreateObject("WbemScripting.SWbemDateTime")
strComputer = Wscript.Arguments.Item(0)
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", actualTime, Now)
If TimeinQueue > 15 Then
strPrinterName = Split(objPrinter.Name,",",-1,1)
Wscript.Echo strPrinterName(0) & vbtab & vbTab & objPrinter.JobID & vbTab & dtmActualTime & vbTab & objPrinter.TotalPages
End If
Next
‎12-03-2008 08:17 PM
‎12-03-2008 08:10 PM
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
‎05-07-2008 02:33 PM
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colInstalledPrinters = objWMIService.ExecQuery _
("Select * from Win32_Printer Where Name = 'HP QuietJet'")
For Each objPrinter in colInstalledPrinters
objPrinter.CancelAllJobs()
Next
‎05-07-2008 02:21 AM
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now