Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import wmi
- c = wmi.WMI ()
- for process in c.Win32_Process ():
- print process.ProcessId, process.Name
- import wmi
- c = wmi.WMI ("some_other_machine")
- #
- # class WMI
- #
- class _wmi_namespace:
- """A WMI root of a computer system. The classes attribute holds a list
- of the classes on offer. This means you can explore a bit with
- things like this::
- c = wmi.WMI ()
- for i in c.classes:
- if "user" in i.lower ():
- print i
- """
- def __init__ (self, namespace, find_classes):
- print ('class is called')
- _set (self, "_namespace", namespace)
- #
- # wmi attribute preserved for backwards compatibility
- #
- _set (self, "wmi", namespace)
- self._classes = None
- self._classes_map = {}
- #
- # Pick up the list of classes under this namespace
- # so that they can be queried, and used as though
- # properties of the namespace by means of the __getattr__
- # hook below.
- # If the namespace does not support SubclassesOf, carry on
- # regardless
- #
- if find_classes:
- _ = self.classes
Add Comment
Please, Sign In to add comment