| |

VerySource

 Forgot password?
 Register
Search
View: 1854|Reply: 1

How to get printer information

[Copy link]

1

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2021-3-8 17:00:02
| Show all posts |Read mode
Now I can get the total number of jobs in the printed print spooler through WMI, but I want to get the file name, status, user, number of pages, and printing time of each job. How do I do that?
Reply

Use magic Report

1

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

 Author| Post time: 2021-3-8 17:15:01
| Show all posts
This is the information I searched on the Internet. Paste the following code into Notepad, save it as a vbs suffix file and execute it to get the total number of jobs and other information.
----------
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
   &"{impersonationLevel=impersonate}!\\"&strComputer&"\root\cimv2")
Set colPrintQueues = objWMIService.ExecQuery _
    ("Select * from Win32_PerfFormattedData_Spooler_PrintQueue Where Name <>'_Total'")
For Each objPrintQueue in colPrintQueues
    Wscript.Echo "Name: "&objPrintQueue.Name
    Wscript.Echo "Jobs: "&objPrintQueue.Jobs
    Wscript.Echo "Current jobs spooling: "&objPrintQueue.JobsSpooling
    Wscript.Echo "Maximum jobs spooling: "&objPrintQueue.MaxJobsSpooling
    Wscript.Echo "Total jobs printed: "&objPrintQueue.TotalJobsPrinted
    Wscript.Echo "NamJob errors: "&objPrintQueue.JobErrors
    Wscript.Echo "Not ready errors: "&objPrintQueue.NotReadyErrors
    Wscript.Echo "Out of paper errors: "&objPrintQueue.OutOfPaperErrors
Next
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list