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.

133 lines
4.8 KiB

  1. '------------------------------------------------------------------------------------------------
  2. '
  3. ' Display the properties of the specIfied node. Different properties
  4. ' are displayed depending on the class of the node.
  5. '
  6. ' Usage: dispnode <--ADSPath|-a ADS PATH OF NODE>
  7. ' [--help|-h]
  8. '
  9. ' ADS PATH The Path of the node to be displayed
  10. '
  11. ' Example 1: dispnode -a IIS://LocalHost/w3svc
  12. ' Example 2: dispnode --adspath IIS://LocalHost
  13. '------------------------------------------------------------------------------------------------
  14. ' Force explicit declaration of variables.
  15. Option Explicit
  16. On Error Resume Next
  17. Dim AdsPath, AdminObject
  18. Dim oArgs, ArgNum
  19. Set oArgs = WScript.Arguments
  20. ArgNum = 0
  21. While ArgNum < oArgs.Count
  22. Select Case LCase(oArgs(ArgNum))
  23. Case "--adspath","-a":
  24. ArgNum = ArgNum + 1
  25. AdsPath = oArgs(ArgNum)
  26. Case "--help","-h":
  27. Call DisplayUsage
  28. Case Else:
  29. Call DisplayUsage
  30. End Select
  31. ArgNum = ArgNum + 1
  32. Wend
  33. If AdsPath = "" Then
  34. Call DisplayUsage
  35. End If
  36. ' Grab the node object
  37. Set AdminObject = GetObject(AdsPath)
  38. If Err <> 0 Then
  39. WScript.Echo "Couldn't get the node object!"
  40. WScript.quit(1)
  41. End If
  42. WScript.Echo "Name: " & AdminObject.Name
  43. WScript.Echo "Class: " & AdminObject.Class
  44. WScript.Echo "Schema: " & AdminObject.Schema
  45. WScript.Echo "GUID: " & AdminObject.GUID
  46. WScript.Echo "Parent: " & AdminObject.Parent
  47. WScript.Echo
  48. If (AdminObject.Class = "IIsComputer") Then
  49. WScript.Echo "Memory Cache Size: " & AdminObject.MemoryCacheSize
  50. WScript.Echo "Max Bandwidth: " & AdminObject.MaxBandWidth
  51. End If
  52. If (AdminObject.Class = "IIsWebService") Then
  53. WScript.Echo "Directory Browsing: " & AdminObject.EnableDirBrowsing
  54. WScript.Echo "Default Document: " & AdminObject.DefaultDoc
  55. WScript.Echo "Script Access: " & AdminObject.AccessScript
  56. WScript.Echo "Execute Access: " & AdminObject.AccessExecute
  57. End If
  58. If (AdminObject.Class = "IIsFtpService") Then
  59. WScript.Echo "Enable Port Attack: " & AdminObject.EnablePortAttack
  60. WScript.Echo "Lower Case Files: " & AdminObject.LowerCaseFiles
  61. End If
  62. If (AdminObject.Class = "IIsWebServer") Then
  63. WScript.Echo "1st Binding: " & AdminObject.ServerBindings(0)(0)
  64. WScript.Echo "State: " & ServerState(AdminObject.ServerState)
  65. WScript.Echo "Key Type: "& AdminObject.KeyType
  66. End If
  67. If (AdminObject.Class = "IIsFtpServer") Then
  68. WScript.Echo "State:" & ServerState(AdminObject.ServerState)
  69. WScript.Echo "Greeting Message: " & AdminObject.GreetingMessage
  70. WScript.Echo "Exit Message: " & AdminObject.ExitMessage
  71. WScript.Echo "Max Clients Message: " & AdminObject.MaxClientsMessage
  72. WScript.Echo "Anonymous Only: " & AdminObject.AnonymousOnly
  73. End If
  74. If (AdminObject.Class = "IIsWebVirtualDir") Then
  75. WScript.Echo "Path: " & AdminObject.path
  76. WScript.Echo "Default document: " & AdminObject.DefaultDoc
  77. WScript.Echo "UNC User Name: " & AdminObject.UNCUserName
  78. WScript.Echo "Directory browsing is " & CStr(CBool(AdminObject.EnableDirBrowsing))
  79. WScript.Echo "Read Access is " & CStr(CBool(AdminObject.AccessRead))
  80. WScript.Echo "Write Access is " & CStr(CBool(AdminObject.AccessWrite))
  81. End If
  82. If (AdminObject.Class ="IIsFtpVirtualDir") Then
  83. WScript.Echo "Path: " & AdminObject.path
  84. WScript.Echo "UNC User Name: " & AdminObject.UNCUserName
  85. WScript.Echo "Read Access is " & CStr(CBool(AdminObject.AccessRead))
  86. WScript.Echo "Write Access is " & CStr(CBool(AdminObject.AccessWrite))
  87. End If
  88. If (AdminObject.Class = "IIsWebService") or (AdminObject.Class = "IIsFTPService") or (AdminObject.Class = "IIsWebServer") or (AdminObject.Class = "IIsFTPServer") Then
  89. WScript.Echo "Server Comment: " & AdminObject.ServerComment
  90. WScript.Echo "Anonymous User: " & AdminObject.AnonymousUserName
  91. WScript.Echo "Default Logon Domain: " & AdminObject.DefaultLogonDomain
  92. WScript.Echo "Max Connections: " & AdminObject.MaxConnections
  93. WScript.Echo "Connection Timeout: " & AdminObject.ConnectionTimeout
  94. WScript.Echo "Read Access: " & AdminObject.AccessRead
  95. WScript.Echo "Write Access: " & AdminObject.AccessWrite
  96. WScript.Echo "Log: " & Not AdminObject.DontLog
  97. End If
  98. ' This function interprets the various settings of the
  99. ' ServerState variable.
  100. Function ServerState(StateVal)
  101. Select Case StateVal
  102. Case 1 ServerState = "Starting"
  103. Case 2 ServerState = "Started"
  104. Case 3 ServerState = "Stopping"
  105. Case 4 ServerState = "Stopped"
  106. Case 5 ServerState = "Pausing"
  107. Case 6 ServerState = "Paused"
  108. Case 7 ServerState = "Continuing"
  109. Case Else: ServerState = "Unknown!"
  110. End Select
  111. End Function
  112. ' Display the usage for this script
  113. Sub DisplayUsage
  114. WScript.Echo "Usage: dispnode <--ADSPath|-a ADS PATH OF NODE> [--help|-h]"
  115. WScript.Echo " ADS PATH - The Path of the node to be displayed"
  116. WScript.Echo ""
  117. WScript.Echo "Example 1: dispnode -a IIS://LocalHost/w3svc"
  118. WScript.Echo "Example 2: dispnode --adspath IIS://MachineName/w3svc/1"
  119. WScript.Quit
  120. End Sub