by Anonymous (267 Submissions)
Category: Windows System Services
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Sun 4th May 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)
WMI sample: lists the printjobs on a printserver. Written in VBScript. Uses Win32_PrintJob WMI class.
' This function lists the printjobs on a printserver
' Check out http://www.activexperts.com for more samples and components
Sub ListobjPrintJobs( strPrintServer )
Dim strObject, objPrintJobSet
strObject = "winmgmts://" & strPrintServer
Set objPrintJobSet = GetObject( strObject ).InstancesOf( "Win32_PrintJob" )
If( objPrintJobSet.Count = 0 ) Then
WScript.Echo "No print jobs!"
End If
For Each objPrintJob in objPrintJobSet
WScript.Echo objPrintJob.Name
WScript.Echo objPrintJob.JobId
WScript.Echo objPrintJob.Status
WScript.Echo objPrintJob.TotalPages
Wscript.Echo ""
Next
End Sub
' Main
Dim strPrintServer
Do
strPrintServer = inputbox( "Please enter the name of the printserver (plain name, no UNC format)", "Input" )
Loop until strPrintServer <> ""
ListobjPrintJobs( strPrintServer )
WScript.Echo( "Check out http://www.activexperts.com for more samples and components" )
No comments have been posted about WMI sample: lists the printjobs on a printserver. Written in VBScript. Uses Win32_PrintJob WMI clas. Why not be the first to post a comment about WMI sample: lists the printjobs on a printserver. Written in VBScript. Uses Win32_PrintJob WMI clas.