[python-win32] Finding installed softwares on the remote mach ine using WMI

Tim Golden tim.golden at viacom-outdoor.co.uk
Mon Jul 7 10:19:28 EDT 2003


Anthony Catalfo:

> Would you have an Idea how to use 

> FindFirstPrinterChangeNotification in python(to
> monitor printer status) or how to use vb.net from
> python?

I'm afraid the answer to both these questions 
 is No, altho' the first is probably best answered
 by looking at ctypes (there's a good worked example
 at http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/208699);

and the second is slightly more vague: what exactly do
 you mean by "use vb.net from python"? I suspect you 
 mean that you've come across an example which does
 what you want and which runs in VB.NET. If that is the
 case then you're either going to have to translate it
 into the equivalent Python (which is probably what
 your first question's about) or find someone more
 knowledgeable than I am about the .NET framework who
 could talk about interoperation.

Meanwhile, the following snippet will watch for print
 jobs using WMI. Hope it's of some use, if only as a
 starting point:

#
# uses the WMI module at http://tgolden.sc.sabren.com/python/wmi.html
#

import wmi

c = wmi.WMI ()
new_print_jobs = c.watch_for (
  notification_type="Creation", 
  wmi_class="Win32_PrintJob", 
  delay_secs=1
)
while 1:
  new_print_job = new_print_jobs ()
  print new_print_job

TJG

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________



More information about the Python-win32 mailing list