Guest User

Untitled

a guest
Jan 19th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. import wmi
  2. c = wmi.WMI ()
  3.  
  4. for process in c.Win32_Process ():
  5. print process.ProcessId, process.Name
  6.  
  7. import wmi
  8. c = wmi.WMI ("some_other_machine")
  9.  
  10. #
  11. # class WMI
  12. #
  13. class _wmi_namespace:
  14. """A WMI root of a computer system. The classes attribute holds a list
  15. of the classes on offer. This means you can explore a bit with
  16. things like this::
  17.  
  18. c = wmi.WMI ()
  19. for i in c.classes:
  20. if "user" in i.lower ():
  21. print i
  22. """
  23. def __init__ (self, namespace, find_classes):
  24. print ('class is called')
  25. _set (self, "_namespace", namespace)
  26. #
  27. # wmi attribute preserved for backwards compatibility
  28. #
  29. _set (self, "wmi", namespace)
  30.  
  31. self._classes = None
  32. self._classes_map = {}
  33. #
  34. # Pick up the list of classes under this namespace
  35. # so that they can be queried, and used as though
  36. # properties of the namespace by means of the __getattr__
  37. # hook below.
  38. # If the namespace does not support SubclassesOf, carry on
  39. # regardless
  40. #
  41. if find_classes:
  42. _ = self.classes
Add Comment
Please, Sign In to add comment