home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / iis4_07.cab / dispnode.vbs < prev    next >
Text File  |  1997-10-25  |  5KB  |  134 lines

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