Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.46 KB | None | 0 0
  1. ' -----------------------------------------------------------------------------
  2. ' RENAME THIS FILE TO MOVEIIS.VBS BEFORE USING!!!
  3. ' -----------------------------------------------------------------------------
  4. ' Modify IIS Metabase Properties for new data location
  5. ' Change the params and params2 value depending on which components are
  6. ' installed
  7. ' set params to 10 if NNTP and FTP are installed and running otherwise
  8. ' set params to 9 and comment out msftpsvc line if FTP is not installed
  9. ' set params2 to 4 if FTP and NNTP are installed and runnning otherwise
  10. ' set params2 to 1 and comment out cisvc, msftpsvc and nntpsvc line if the
  11. ' Indexing service, FTP service, and Network News Transport Service are
  12. ' not installed
  13. ' References to the Indexing service have been commented out, check comments
  14. ' on line 75 to change Indexing Service settings
  15.  
  16.  
  17. 'Stop IIS services before continuing
  18.  
  19. Set WSHShell = Wscript.CreateObject("Wscript.Shell")
  20. WSHShell.PopUp "Stopping all Internet Services..."
  21.  
  22. ret = WshShell.Run ("net stop iisadmin /y", 1, TRUE)
  23.  
  24. If ret = 0 then
  25. WSHShell.PopUp "IISADMIN service was stopped successfully, continuing"
  26. 'restart()
  27. else
  28. WSHShell.PopUp "IISADMIN failed to stop successfully. The error code is " & ret
  29. Wscript.Quit 1
  30. end if
  31.  
  32. Dim params(6)
  33. Dim x, ret
  34. Dim params2(2)
  35.  
  36. Params(0) = "w3svc/1/root/path d:inetpubwwwroot"
  37. Params(1) = "w3svc/1/root/scripts/path d:inetpubscripts "
  38. Params(2) = "w3svc/1/root/iissamples/path d:inetpubiissamples"
  39. Params(3) = "smtpsvc/1/BadMailDirectory d:inetpubmailrootBadMail"
  40. Params(4) = "smtpsvc/1/PickupDirectory d:inetpubmailrootPickup"
  41. Params(5) = "smtpsvc/1/QueueDirectory d:inetpubmailrootQueue"
  42. Params(6) = "smtpsvc/1/DropDirectory d:inetpubmailrootDrop"
  43. 'Params(7) = "nntpsvc/1/NewsPickupDirectory d:inetpubnntpfilepickup"
  44. 'Params(8) = "nntpsvc/1/NewsFailedPickupDirectory d:inetpubnntpfilefailedpickup"
  45. 'Params(9) = "nntpsvc/1/NewsDropDirectory d:inetpubnntpfiledrop"
  46. 'Params(10) = "msftpsvc/1/root/path d:inetpubftproot"
  47.  
  48. Set WshSysEnv = WshShell.Environment("PROCESS")
  49.  
  50. For Each x In Params
  51. ret = WSHShell.Run ("cscript.exe " & "c:inetpubadminscriptsadsutil.vbs SET " & x, 1, TRUE)
  52. Next
  53.  
  54. ' Verify Settings were successfully applied
  55. If ret = 0 then
  56.  
  57. WSHShell.PopUp "The new metabase settings have been successfully updated. The new Web Data path is d:inetpub"
  58. else
  59. WSHShell.PopUp "The Configuration changes failed. The error code is " & ret
  60. Wscript.Quit 1
  61. end if
  62. wscript.Sleep 5000
  63.  
  64. ' Move Data to new location (D:Inetpub) using xcopy.exe (this can be changed
  65. ' from xcopy to move so the data is actually moved from current locale)
  66.  
  67. ret = WSHShell.Run ("xcopy c:inetpub D:Inetpub /s /e /q /i /h /r /k /o /x" , 1, TRUE)
  68. If ret = 0 then
  69. WSHShell.PopUp "The data has been successfully moved to D:Inetpub"
  70. else
  71. WSHShell.PopUp "The data move failed. The error code is " & ret
  72. Wscript.Quit 1
  73. end if
  74.  
  75. ' INDEX SERVICE CONFIGURATION
  76. ' Remove comments from the next 29 lines to configure cisvc through this script
  77. '
  78. '' Update Web Catalog to be for D:Inetpub
  79. '
  80. ''Stop Content Index Service
  81. '
  82. 'Set WSHShell = Wscript.CreateObject("Wscript.Shell")
  83. ' WSHShell.PopUp "Stopping Index Service..."
  84. '
  85. 'ret = WshShell.Run ("net stop cisvc", 1, TRUE)
  86.  
  87. 'If ret = 0 then
  88. ' chgeCat()
  89. 'else
  90. ' WSHShell.PopUp "Content Index service failed to stop successfully. The error code is " & ret
  91. ' Wscript.Quit 1
  92. 'end if
  93. '
  94. 'Function chgeCat()
  95. 'Set WshShell = WScript.CreateObject("WScript.Shell")
  96. '
  97. ''Delete Catalogs
  98. 'WshShell.RegDelete "HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlContentIndexCatalogsWeb"
  99.  
  100. ' Delete Web Catalog.
  101. 'WshShell.RegDelete "HKLMSYSTEMCurrentControlSetControlContentIndexCatalogsSystem"
  102.  
  103. ' Delete System Catalog.
  104. '
  105. ''Modify existing Web catalog entry
  106. 'WshShell.RegWrite "HKLMSYSTEMCurrentControlSetControlContentIndexCatalogsWebLocation", "D:Inetpub"
  107. 'WshShell.RegWrite "HKLMSYSTEMCurrentControlSetControlContentIndexCatalogsWebIsIndexingW3Svc", 1, "REG_DWORD"
  108. '
  109. 'end function
  110.  
  111. 'Start Services (WWW, SMTP, CISVC, NNTP, MSFTPSVC)
  112.  
  113. Set WSHShell = Wscript.CreateObject("Wscript.Shell")
  114. WSHShell.PopUp "Attempting to restart stopped Services..."
  115.  
  116. Params2(0) = "w3svc"
  117. Params2(1) = "smtpsvc"
  118. 'Params2(2) = "cisvc"
  119. 'Params2(3) = "nntpsvc"
  120. 'Params2(4) = "msftpsvc"
  121.  
  122. For Each x In Params2
  123. ret = WshShell.Run ("net start " & x, 1, TRUE)
  124. wscript.Sleep 5000
  125. Next
  126.  
  127. If ret = 0 then
  128. WSHShell.PopUp "Services were started successfully, modifications complete"
  129. else
  130. WSHShell.PopUp "One or more services fail to start successfully. The error code is " & ret
  131. Wscript.Quit 1
  132. end if
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement