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.

76 lines
1.8 KiB

  1. '
  2. L_Welcome_MsgBox_Message_Text = "This script demonstrates how to add/remove 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 frame
  10. Dim views
  11. Dim view
  12. Dim scopenamespace
  13. Dim rootnode
  14. Dim Nodes
  15. Dim scopenode
  16. Dim SnapNode1
  17. Dim Sample
  18. Dim Cert
  19. Dim Services
  20. Dim MultiSel
  21. Dim Eventlog
  22. Dim Index
  23. 'get the various objects we'll need
  24. Set mmc = wscript.CreateObject("MMC20.Application")
  25. Set frame = mmc.Frame
  26. Set doc = mmc.Document
  27. Set namespace = doc.ScopeNamespace
  28. Set rootnode = namespace.GetRoot
  29. Set views = doc.views
  30. Set view = views(1)
  31. Set snapins = doc.snapins
  32. Set Sample = snapins.Add("{18731372-1D79-11D0-A29B-00C04FD909DD}") ' Sample snapin
  33. Set Cert = snapins.Add("{53D6AB1D-2488-11D1-A28C-00C04FB94F17}") ' Certificates s
  34. Set Index = snapins.Add("{95AD72F0-44CE-11D0-AE29-00AA004B9986}") ' index snapin
  35. Set Eventlog = snapins.Add("{975797FC-4E2A-11D0-B702-00C04FD8DBF7}") ' eventlog
  36. Set Services = snapins.Add("{58221c66-ea27-11cf-adcf-00aa00a80033}") ' the services
  37. snapins.Remove Cert
  38. snapins.Remove Eventlog
  39. Set scopenamespace = doc.scopenamespace
  40. Set view = doc.ActiveView
  41. Set Node = view.ActiveScopeNode
  42. snapins.Remove Sample
  43. snapins.Remove Services
  44. Set mmc = Nothing
  45. ' ********************************************************************************
  46. ' *
  47. ' * Welcome
  48. ' *
  49. Sub Welcome()
  50. Dim intDoIt
  51. intDoIt = MsgBox(L_Welcome_MsgBox_Message_Text, _
  52. vbOKCancel + vbInformation, _
  53. L_Welcome_MsgBox_Title_Text )
  54. If intDoIt = vbCancel Then
  55. WScript.Quit
  56. End If
  57. End Sub