Мониторинг очереди печати

Option Explicit 
'On Error Resume Next
Dim strComputer
dim wmiNS
dim wmiQuery
dim objWMIService
dim colItems
dim objItem
Dim intTotalJobs
Dim intTotalPages
Dim intMaxPrintJob

strComputer = "."
wmiNS = "\root\cimv2"
wmiQuery = "Select * from win32_PrintJob"
Set objWMIService = GetObject("winmgmts:\\" _
	& strComputer & wmiNS)
Set colItems = objWMIService.ExecQuery(wmiQuery)

If colItems.count = 0 Then
WScript.Echo("There are no print jobs at this time")
Else
For Each objitem In colItems
    intTotalJobs = intTotalJobs + 1
    intTotalPages = intTotalPages + objitem.TotalPages
    If objitem.TotalPages > intMaxPrintJob Then
        intMaxPrintJob = objitem.TotalPages
    End If
Next
Wscript.Echo "Total print jobs in queue: " & intTotalJobs
Wscript.Echo "Total pages in queue: " & intTotalPages
Wscript.Echo "Largest print job in queue: " & intMaxPrintJob
End If
Интересное на сайте: 
0
Голосов пока нет

Оставить комментарий