Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.2 KiB

  1. use OLE;
  2. use Win32;
  3. # Get a favorite class from CIMOM
  4. $locator = CreateObject OLE 'WbemScripting.SWbemLocator';
  5. $service = $locator->ConnectServer (".", "root/cimv2");
  6. $class = $service->Get ('Win32_BaseService');
  7. #Enumerate throgh the properties using BeginEnumeration/Next/EndEnumeration
  8. $p = $class->{Properties_};
  9. #Note we need a way to detect whether something is an array
  10. while (defined ($prop = $p->Next())) {
  11. print $prop->{Name};
  12. print "\t";
  13. print $prop->{Value};
  14. print "\t";
  15. print $prop->{Origin};
  16. print "\t";
  17. print $prop->{IsLocal};
  18. print "\t";
  19. print $prop->{IsArray};
  20. print "\n";
  21. print "\tQualifiers:\n";
  22. $q = $prop->{Qualifiers_};
  23. $q->BeginEnumeration ();
  24. while (defined ($qual = $q->Next())) {
  25. print "\t\t";
  26. print $qual->{Name};
  27. print "=";
  28. $V = $qual->{Value};
  29. @VA = ($qual->{Value});
  30. print @VA;
  31. print scalar($V);
  32. print "\n";
  33. }
  34. $q->EndEnumeration ();
  35. }
  36. $p->EndEnumeration();
  37. # This illustrates that when Perl fails to find a DISPID for the
  38. # name it tries to Invoke with DISPID=DISPID_VALUE (!?)
  39. $p1 = $p->{StartMode};
  40. print $p1->{Name};
  41. print "\n";
  42. print $p1->{Origin};
  43. print "\n";
  44. print $p1->{IsLocal};
  45. print "\n";