strComputer = «.»
Set objWMIService = GetObject(«winmgmts:» _
& «{impersonationLevel=impersonate}!\\» & strComputer & «\root\cimv2»)
Set colPrintJobs = objWMIService.ExecQuery _
(«Select * from Win32_PrintJob «)
For Each objPrintJob in colPrintJobs
intTotalJobs = intTotalJobs + 1
intTotalPages = objPrintJob.TotalPages
intPagesPrinted = objPrintJob.PagesPrinted
nameprinter = objPrintJob.Name
Wscript.Echo «Name » & nameprinter
Wscript.Echo «paginas Impresas » & intPagesPrinted
Wscript.Echo «Total » & intTotalPages
Next
Las propiedades que podemos consultar de una impresora son:
class Win32_PrintJob : CIM_Job
{
string Caption;
string Color;
string DataType;
string Description;
string Document;
string DriverName;
datetime ElapsedTime;
string HostPrintQueue;
datetime InstallDate;
uint32 JobId;
string JobStatus;
string Name;
string Notify;
string Owner;
uint32 PagesPrinted;
uint32 PaperLength;
string PaperSize;
uint32 PaperWidth;
string Parameters;
string PrintProcessor;
uint32 Priority;
uint32 Size;
datetime StartTime;
string Status;
uint32 StatusMask;
datetime TimeSubmitted;
uint32 TotalPages;
datetime UntilTime;
};