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

  1. Option Explicit
  2.  
  3. On Error Resume Next
  4.  
  5. Const Error_NoNode = "Unable to open "
  6.  
  7. Dim oArgs, ArgNum, propNum, ArgPath
  8. Dim ArgComputers, WebDirList
  9.  
  10.  
  11. propNum = 0
  12. ArgNum = 0
  13. ArgComputers = Array("LocalHost")
  14.  
  15. WebDirList = Array("IISHELP/ado", "IISHELP/adc", "IISHELP/msadc",_
  16.                    "IISHELP/ics", "msadc","IISHELP/SSE/SA","IISHELP/SSE/UA Express","IISHELP/ics/I_cmak",_
  17.                    "IISHELP/ics/I_cps","IISHELP/ics/I_ias", "CertSrv", "CertQue", "CertAdm", "CertControl")
  18.  
  19. Set oArgs = WScript.Arguments
  20. While ArgNum < oArgs.Count
  21.     Select Case LCase(oArgs(ArgNum))
  22.         Case "--computer","-c":
  23.             ArgNum = ArgNum + 1
  24.             ArgComputers = Split(oArgs(ArgNum), ",", -1)
  25.         Case "--help","-?":
  26.             Call DisplayUsage
  27.         Case Else:
  28.             Call DisplayUsage
  29.     End Select    
  30.     ArgNum = ArgNum + 1
  31. Wend
  32.  
  33. Dim compIndex
  34.  
  35. for compIndex = 0 to UBound(ArgComputers)
  36.     Call FixCfg(ArgComputers(compIndex))
  37. next
  38.  
  39. SUB FixCfg(Computer)
  40.     On Error Resume Next
  41.     Dim oAdmin, fullPath, node, dir, i
  42.  
  43.     for i = 0 to UBound(WebDirList)
  44.         dir = WebDirList(i)
  45.         fullPath = "IIS://"&Computer&"/W3svc/1/Root/"&dir
  46.         set node = GetObject(fullPath)
  47.         If Err.Number <> 0 Then
  48.             Display Error_NoNode & dir
  49.             Err.Clear
  50.         Else
  51.             Trace "Setting "&dir& " to Virtual Directory."
  52.             node.KeyType = "IIsWebVirtualDir"
  53.             node.SetInfo
  54.             If Err.Number <> 0 Then
  55.                 Display "Unable to mark " & dir & " as Virtual Directory"
  56.                 Err.Clear
  57.             end if
  58.         End If
  59.     next
  60.     Trace "Done fixing Configuration for "&Computer
  61. End Sub
  62.  
  63. Sub Display(Msg)
  64.     WScript.Echo "Error Code: " & Hex(Err) & " - " & Msg
  65. End Sub
  66.  
  67. Sub Trace(Msg)
  68.     WScript.Echo Msg
  69. End Sub
  70.  
  71. Sub DisplayUsage
  72.     WScript.Echo "Usage: fixCfg  [--computer|-c COMPUTER1[,COMPUTER2...]]"
  73.     WScript.Quit (1)
  74. End Sub
  75.