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.

126 lines
3.0 KiB

  1. <%@ LANGUAGE = VBScript %>
  2. <% Option Explicit %>
  3. <!-- #include file="directives.inc" -->
  4. <%
  5. ' Script to clone settings from one node to another.
  6. ' Assumes nodes are the same type.
  7. ' If a site is cloned, only the Site type properties will be cloned.
  8. ' The Root node should be cloned separately, for maximum flexibility in the script.
  9. ' Parameters:
  10. ' sFromNode - ADSpath of the node to clone settings from
  11. ' sToNode - ADSpath of the node to clone settings to
  12. ' aProperties - A string array containing property names indicating settings to clone
  13. '
  14. ' Notes: some properties will not work generically, and must be special cased.
  15. ' currently, this works for single valued properties only.
  16. Dim SpecProps
  17. SpecProps = "GRANTBYDEFAULT"
  18. Dim sFromNode, sToNode
  19. Dim oFromNode, oToNode
  20. Dim aProperties
  21. Dim props, sProp
  22. Dim bWroteData
  23. sFromNode = Request("sFromNode")
  24. sToNode = Request("sToNode")
  25. '#IFDEF _DEBUG
  26. Response.write Request.Querystring()& "<BR>"
  27. Response.write "From Node:" & sFromNode & "<BR>"
  28. Response.write "To Node:" & sToNode & "<BR>"
  29. '#ENDDEF _DEBUG
  30. props = Request("prop")
  31. aProperties = split(props,",")
  32. Set oFromNode=GetObject(sFromNode)
  33. Set oToNode=GetObject(sToNode)
  34. '#IFDEF _DEBUG
  35. Response.write oToNode.ADsPath & "<BR>"
  36. Response.write oFromNode.ADsPath & "<BR>"
  37. For each sProp in aProperties
  38. sProp = trim(sProp)
  39. Response.write sProp & "<BR>"
  40. Response.write "To Node Start Val" &oToNode.Get(sProp) & "<BR>"
  41. Response.write "From Node Start Val" & oFromNode.Get(sProp) & "<BR>"
  42. Next
  43. Response.write "<P>"
  44. '#ENDDEF _DEBUG
  45. For each sProp in aProperties
  46. sProp = trim(sProp)
  47. bWroteData = writeProp(oToNode, sProp, oFromNode.Get(sProp))
  48. '#IFDEF _DEBUG
  49. if not bWroteData then
  50. Response.write sProp & "<BR>"
  51. Response.write "Old To Node" &oToNode.Get(sProp) & "<BR>"
  52. Response.write "Old From Node" & oFromNode.Get(sProp) & "<BR>"
  53. end if
  54. Response.write "<P>"
  55. '#ENDDEF _DEBUG
  56. Next
  57. '#IFDEF _DEBUG
  58. Response.write "Error:" & err & "<BR>"
  59. '#ENDDEF_DEBUG
  60. oToNode.SetInfo
  61. '#IFDEF _DEBUG
  62. Response.write "Error:" & err & "<BR>"
  63. For each sProp in aProperties
  64. sProp = trim(sProp)
  65. Response.write sProp & "<BR>"
  66. Response.write "To Node" &oToNode.Get(sProp) & "<BR>"
  67. Response.write "From Node" & oFromNode.Get(sProp) & "<BR>"
  68. Next
  69. Response.write "<P>"
  70. '#ENDDEF _DEBUG
  71. ' this is basically the same function (writeStdProp)
  72. ' that lives in iiput.asp, however
  73. ' we ALWAYS write the value if we are setting with templates,
  74. ' even if it is inheriting the same values...
  75. Function writeProp(thisobj, key, newval)
  76. On Error Resume Next
  77. dim curval,value
  78. curval=thisobj.Get(key)
  79. if typename(newval) <> typename(curval) then
  80. Select Case typename(curval)
  81. Case "Boolean"
  82. value = (UCase(newval) = "TRUE")
  83. Case "Long"
  84. value = cLng(newval)
  85. Case Else
  86. value = newval
  87. End Select
  88. else
  89. value = newval
  90. end if
  91. thisobj.Put key, (value)
  92. writeProp = True
  93. '#IFDEF _DEBUG
  94. if err <> 0 then
  95. Response.write err
  96. end if
  97. '#ENDDEF _DEBUG
  98. End Function
  99. %>