PC Review Forums Newsgroups Windows XP Windows XP WMI WMI for printer page count

Reply

WMI for printer page count

 
Thread Tools Rate Thread
Old 22-08-2004, 09:00 PM   #1
wiwa
Guest
 
Posts: n/a
Default WMI for printer page count


Hi,

I would like to write a program that gets the printer page count from
several network printers (all connected to 1 print server). I think WMI is
suited for that purpose but I don't know exactly how to start. Anyone who
can help with some sample code or pointers to usefull websites.

Thanks,

WiWa


  Reply With Quote
Old 31-08-2004, 08:41 PM   #2
Philip Nunn [MSFT]
Guest
 
Posts: n/a
Default Re: WMI for printer page count

Here's a script to get you started. Below is also some links for further
information.


const wbemFlagReturnImmediately = &h10
const wbemFlagForwardOnly = &h20

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMv2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PrintJob",
"WQL", _
wbemFlagReturnImmediately +
wbemFlagForwardOnly)

for each objItem In colItems
wscript.echo "Print Job:" & vbTab & objItem.Name
wscript.echo "Total Pages:" & vbTab & objItem.TotalPages
wscript.echo "PagesPrinted:" & vbTab & objItem.PagesPrinted
wscript.echo
next



WMI capabilities also include eventing, remoting, querying, views, user
extensions to schema, instrumentation, and more.

To learn more about WMI, go to http://msdn.microsoft.com/library/default.asp
and search for the keyword phrase "About WMI"


The Microsoft Developers Network (MSDN) and TechNet are both good sources of
samples. Here are some links to useful locations on these sites:

. The TechNet Script Center
Includes hundreds of sample scripts categorized by technology and
administrative task.
http://go.microsoft.com/fwlink/?LinkId=24771.

. MSDN
http://msdn.microsoft.com/library.
For WMI scripts, search for "WMI System Administration scripts".
For WMIC (the WMI Command Line Utility), see
http://msdn.microsoft.com/library/d...dk/wmi/wmic.asp .

. The WMI Software Developers Kit (SDK)

http://www.microsoft.com/msdownload...rmsdk/sdkupdate
For a set of problem solutions by category, see Using WMI > WMI Tasks
for Scripts and Applications.

. The Windows 2000 Scripting Guide online
The complete text of the book, which includes many examples of WMI
scripting.
http://www.microsoft.com/resources/...us/default.mspx

. The "Tales from the Script" column on TechNet
Basic and intermediate scripting topics.
http://www.microsoft.com/technet/co...ts/default.mspx

. The "Scripting Clinic" column on MSDN
More advanced scripting topics.
http://msdn.microsoft.com/library/d...tentid=28001169

. Newsgroups
You can post questions about WMI and WMI applications or scripts to
several newsgroups on the Msnews.microsoft.com news server:
Microsoft.public.win32.programmer.wmi

Microsoft.public.windowsxp.wmi

Microsoft.public.windows.server.scripting



--
Philip Nunn [MSFT]
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.
"wiwa" <wim_wauters@skynet.be> wrote in message
news:4129096e$0$4139$ba620e4c@news.skynet.be...
> Hi,
>
> I would like to write a program that gets the printer page count from
> several network printers (all connected to 1 print server). I think WMI is
> suited for that purpose but I don't know exactly how to start. Anyone who
> can help with some sample code or pointers to usefull websites.
>
> Thanks,
>
> WiWa
>
>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off