Source code of Windows XP (NT5)
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.

75 lines
2.1 KiB

  1. '
  2. L_Welcome_MsgBox_Message_Text = "This script demonstrates how to enumerate snapins from scriptable objects."
  3. L_Welcome_MsgBox_Title_Text = "Windows Scripting Host Sample"
  4. Call Welcome()
  5. ' ********************************************************************************
  6. Dim mmc
  7. Dim doc
  8. Dim snapins
  9. Dim snapin
  10. Dim Sample
  11. Dim Cert
  12. Dim Services
  13. Dim MultiSel
  14. Dim Eventlog
  15. Dim Index
  16. Dim SnapinName
  17. Dim OtherData
  18. 'get the various objects we'll need
  19. Set mmc = wscript.CreateObject("MMC20.Application")
  20. Set doc = mmc.Document
  21. Set snapins = doc.snapins
  22. 'Set Sample = snapins.Add("{18731372-1D79-11D0-A29B-00C04FD909DD}") ' Sample snapin
  23. 'Set Cert = snapins.Add("{53D6AB1D-2488-11D1-A28C-00C04FB94F17}") ' Certificates s
  24. 'Set Index = snapins.Add("{95AD72F0-44CE-11D0-AE29-00AA004B9986}") ' index snapin
  25. 'Set Eventlog = snapins.Add("{975797FC-4E2A-11D0-B702-00C04FD8DBF7}") ' eventlog
  26. 'Set Services = snapins.Add("{58221c66-ea27-11cf-adcf-00aa00a80033}") ' the services
  27. OtherData = "Num Snapins: " & snapins.Count
  28. intRet = MsgBox(OtherData, vbInformation, "Snapins count")
  29. ' Enumerate the snapins collection and print the about info for each snapin.
  30. For Each snapin in snapins
  31. SnapinName = snapin.Name
  32. OtherData = "Vendor : " + snapin.Vendor
  33. OtherData = OtherData + ", Version : " + snapin.Version
  34. OtherData = OtherData + ", CLSID : " + snapin.SnapinCLSID
  35. ' intRet = MsgBox(OtherData, vbInformation, "About Information for " & SnapinName)
  36. Next
  37. For i = 1 To snapins.count
  38. Set snapin = snapins.Item(i)
  39. SnapinName = snapin.Name
  40. OtherData = "Vendor : " + snapin.Vendor
  41. OtherData = OtherData + ", Version : " + snapin.Version
  42. OtherData = OtherData + ", CLSID : " + snapin.SnapinCLSID
  43. intRet = MsgBox(OtherData, vbInformation, "About Information for " & SnapinName)
  44. Next
  45. Set mmc = Nothing
  46. ' ********************************************************************************
  47. ' *
  48. ' * Welcome
  49. ' *
  50. Sub Welcome()
  51. Dim intDoIt
  52. intDoIt = MsgBox(L_Welcome_MsgBox_Message_Text, _
  53. vbOKCancel + vbInformation, _
  54. L_Welcome_MsgBox_Title_Text )
  55. If intDoIt = vbCancel Then
  56. WScript.Quit
  57. End If
  58. End Sub