Leaked source code of windows server 2003
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.

966 lines
34 KiB

  1. '
  2. ' Copyright (c) Microsoft Corporation. All rights reserved.
  3. '
  4. ' VBScript Source File
  5. '
  6. ' Script Name: IIsExt.vbs
  7. '
  8. Option Explicit
  9. On Error Resume Next
  10. ' Error codes
  11. Const ERR_OK = 0
  12. Const ERR_GENERAL_FAILURE = 1
  13. '''''''''''''''''''''
  14. ' Messages
  15. Const L_NotEnoughParams_ErrorMessage = "Not enough parameters."
  16. Const L_InvalidSwitch_ErrorMessage = "Invalid switch: %1"
  17. Const L_CmdLib_ErrorMessage = "Could not create an instance of the CmdLib object."
  18. Const L_ChkCmdLibReg_ErrorMessage = "Please register the Microsoft.CmdLib component."
  19. Const L_ScriptHelper_ErrorMessage = "Could not create an instance of the IIsScriptHelper object."
  20. Const L_ChkScpHelperReg_ErrorMessage = "Please, check if the Microsoft.IIsScriptHelper is registered."
  21. Const L_OnlyOneOper_ErrorMessage = "Please specify only one operation at a time."
  22. Const L_PassWithoutUser_ErrorMessage = "Please specify /u switch before using /p."
  23. Const L_WMIConnect_ErrorMessage = "Could not connect to WMI provider."
  24. Const L_Error_ErrorMessage = "Error &H%1: %2"
  25. Const L_Admin_ErrorMessage = "You cannot run this command because you are not an"
  26. Const L_Adminp2_ErrorMessage = "administrator on the server you are trying to configure."
  27. Const L_GetWebSvcObj_ErrorMessage = "Could not get web service object"
  28. Const L_EnApp_ErrorMessage = "Error while configuring application or extension."
  29. Const L_NoApp_ErrorMessage = "The specified application does not exist in the application"
  30. Const L_NoAppp2_ErrorMessage = "dependencies list."
  31. Const L_NoDep_ErrorMessage = "The specified application-extension relationship does not"
  32. Const L_NoDepp2_ErrorMessage = "exist in the application dependencies list."
  33. Const L_NoExt_ErrorMessage = "The extension does not exist in the restriction list."
  34. Const L_NoEfi_ErrorMessage = "The extension file does not exist in the restriction list."
  35. Const L_EnDep_ErrorMessage = "Error while configuring dependency."
  36. Const L_ShowList_ErrorMessage = "Error while showing list. Please confirm that the"
  37. Const L_ShowList2_ErrorMessage = "WebSvcExtRestrictionList and ApplicationDependencies"
  38. Const L_ShowList3_ErrorMessage = "properties exist and are set on the W3SVC node."
  39. Const L_RmEfi_ErrorMessage = "Error trying to delete extension. Make sure it exists"
  40. Const L_RmEfip2_ErrorMessage = "and is deletable."
  41. Const L_EnAppComplete_Message = "Enabling application complete."
  42. Const L_AddDpComplete_Message = "Adding dependency complete."
  43. Const L_RemDpComplete_Message = "Removing dependency complete."
  44. Const L_EnExtComplete_Message = "Enabling extension complete."
  45. Const L_DsExtComplete_Message = "Disabling extension complete."
  46. Const L_DsEFiComplete_Message = "Disabling extension file complete."
  47. Const L_EnEFiComplete_Message = "Enabling extension file complete."
  48. Const L_AdEFiComplete_Message = "Adding extension file complete."
  49. Const L_RmEFiComplete_Message = "Deleting extension file complete."
  50. Const L_ShowListFile_Message = "Status / Extension Path"
  51. Const L_ShowListFile2_Message = "------------------------"
  52. '''''''''''''''''''''
  53. ' Help
  54. Const L_Empty_Text = ""
  55. ' General help messages
  56. Const L_SeeHelp_Message = "Type IIsExt /? for help."
  57. Const L_Help_HELP_General01_Text = "Description: Manages Web Service Extensions."
  58. Const L_Help_HELP_General02_Text = "Syntax: IIsExt [/s <server> [/u <username> [/p <password>]]]"
  59. Const L_Help_HELP_General02a_Text = " [/ListExt | /ListApp | /AddDep | /DisExt"
  60. Const L_Help_HELP_General03_Text = " /EnExt | /RmDep | /EnApp | /EnFile | /DisFile"
  61. Const L_Help_HELP_General04_Text = " /AddFile | /ListFile | /RmFile] <args>"
  62. Const L_Help_HELP_General05_Text = "Switches:"
  63. Const L_Help_HELP_General06_Text = "Value Description"
  64. Const L_Help_HELP_General06a_Text = "/s <server> Connect to machine <server>."
  65. Const L_Help_HELP_General06b_Text = " [Default: this system]"
  66. Const L_Help_HELP_General06c_Text = "/u <username> Connect as <domain>\<username> or"
  67. Const L_Help_HELP_General06d_Text = " <username>. [Default: current user]"
  68. Const L_Help_HELP_General06e_Text = "/p <password> Password for the <username> user."
  69. Const L_Help_HELP_General07_Text = "/EnApp <appname> Enables an application in the"
  70. Const L_Help_HELP_General07a_Text = " application dependencies list."
  71. Const L_Help_HELP_General08_Text = "/ListApp Lists the applications in the"
  72. Const L_Help_HELP_General08a_Text = " application dependencies list."
  73. Const L_Help_HELP_General09_Text = "/AddDep <appname> <ID> [<ID> ...]"
  74. Const L_Help_HELP_General09a_Text = " Adds a dependency between an"
  75. Const L_Help_HELP_General09b_Text = " application in the application"
  76. Const L_Help_HELP_General09c_Text = " dependencies list and a Web Service"
  77. Const L_Help_HELP_General09d_Text = " Extension ID."
  78. Const L_Help_HELP_General10_Text = "/RmDep <appname> <ID> [<ID> ...]"
  79. Const L_Help_HELP_General10a_Text = " Removes a dependency between an"
  80. Const L_Help_HELP_General10b_Text = " application in the application"
  81. Const L_Help_HELP_General10c_Text = " dependencies list and a Web Service"
  82. Const L_Help_HELP_General10d_Text = " Extension ID."
  83. Const L_Help_HELP_General11_Text = "/EnExt <ID> Enables all files for a Web Service"
  84. Const L_Help_HELP_General11a_Text = " Extension with the specified Web"
  85. Const L_Help_HELP_General11b_Text = " Service Extension ID."
  86. Const L_Help_HELP_General12_Text = "/DisExt <ID> Disables all files for a Web Service"
  87. Const L_Help_HELP_General12a_Text = " Extension with the specified Web"
  88. Const L_Help_HELP_General12b_Text = " Service Extension ID."
  89. Const L_Help_HELP_General13_Text = "/ListExt Lists Web Service Extension IDs for"
  90. Const L_Help_HELP_General13a_Text = " all defined Web Service Extensions."
  91. Const L_Help_HELP_General14_Text = "/EnFile <filename> Enables a single file in the"
  92. Const L_Help_HELP_General14a_Text = " restriction list."
  93. Const L_Help_HELP_General15_Text = "/DisFile <filename> Disables a single file in the"
  94. Const L_Help_HELP_General15a_Text = " restriction list."
  95. Const L_Help_HELP_General16_Text = "/ListFile Lists all the files in the"
  96. Const L_Help_HELP_General16a_Text = " restriction list."
  97. Const L_Help_HELP_General17_Text = "/RmFile <filename> Removes a file from the restriction"
  98. Const L_Help_HELP_General17a_Text = " list if it is deletable."
  99. Const L_Help_HELP_General18_Text = "/AddFile <args> Adds a file to the restriction list."
  100. Const L_Help_HELP_General19_Text = "/AddFile /? Displays help for the /AddFile flag."
  101. Const L_Help_HELP_AddFile01_Text = "Description: Adds a file to the restriction list."
  102. Const L_Help_HELP_AddFile02_Text = "Syntax: IIsExt [/s <server> [/u <username> [/p <password>]]]"
  103. Const L_Help_HELP_AddFile02a_Text = " /AddFile <filepath> <access> <ID> <deleteable>"
  104. Const L_Help_HELP_AddFile03_Text = " <ShortDesc>"
  105. Const L_Help_HELP_AddFile07_Text = "<filepath> The fully qualified path to the dll"
  106. Const L_Help_HELP_AddFile08_Text = " or exe, including the filename and"
  107. Const L_Help_HELP_AddFile09_Text = " extension. Special cases include"
  108. Const L_Help_HELP_AddFile09a_Text = " *.dll to enable/disable unlisted"
  109. Const L_Help_HELP_AddFile09b_Text = " ISAPI's and *.exe to enable/disable"
  110. Const L_Help_HELP_AddFile09c_Text = " unlisted CGI's."
  111. Const L_Help_HELP_AddFile10_Text = "<access> Set this to 0 to disable or 1 to"
  112. Const L_Help_HELP_AddFile10a_Text = " enable the file after it is added."
  113. Const L_Help_HELP_AddFile11_Text = "<ID> This ID is an arbitrary identifier"
  114. Const L_Help_HELP_AddFile11a_Text = " that identifies the Web Service"
  115. Const L_Help_HELP_AddFile11b_Text = " Extension the file is associated with."
  116. Const L_Help_HELP_AddFile12_Text = " There can be one or more files for"
  117. Const L_Help_HELP_AddFile12a_Text = " each Web Service Extension"
  118. Const L_Help_HELP_AddFile13_Text = "<deletable> Set this to 0 to prevent this file"
  119. Const L_Help_HELP_AddFile13a_Text = " from being deleted from the restriction"
  120. Const L_Help_HELP_AddFile14_Text = " list or 1 to allow this file to be"
  121. Const L_Help_HELP_AddFile14a_Text = " deleted from the restriction list."
  122. Const L_Help_HELP_AddFile15_Text = "<ShortDesc> This is a brief text description of"
  123. Const L_Help_HELP_AddFile15a_Text = " the Web Service Extension the file is"
  124. Const L_Help_HELP_AddFile16_Text = " associated with. Files with the same"
  125. Const L_Help_HELP_AddFile16a_Text = " ID should also have the same ShortDesc."
  126. ''''''''''''''''''''''''
  127. ' Operation codes
  128. Const OPER_ENAPP = 1
  129. Const OPER_ADDDP = 3
  130. Const OPER_REMDP = 4
  131. Const OPER_ENEXT = 5
  132. Const OPER_DSEXT = 6
  133. Const OPER_ENEFI = 7
  134. Const OPER_DSEFI = 8
  135. Const OPER_ADEFI = 9
  136. Const OPER_RMEFI = 10
  137. Const OPER_LSAPP = 11
  138. Const OPER_LSEXT = 12
  139. Const OPER_LSEFI = 13
  140. '
  141. ' Main block
  142. '
  143. Dim oScriptHelper, oCmdLib
  144. Dim intResult, intOperation
  145. Dim strServer, strUser, strPassword
  146. Dim strCmdLineOptions, strAppName
  147. Dim oError, aArgs
  148. ' Default values
  149. strServer = "."
  150. strUser = ""
  151. strPassword = ""
  152. intOperation = 0
  153. ' Instantiate the CmdLib for output string formatting
  154. Set oCmdLib = CreateObject("Microsoft.CmdLib")
  155. If Err.Number <> 0 Then
  156. WScript.Echo L_CmdLib_ErrorMessage
  157. WScript.Echo L_ChkCmdLibReg_ErrorMessage
  158. WScript.Quit(ERR_GENERAL_FAILURE)
  159. End If
  160. Set oCmdLib.ScriptingHost = WScript.Application
  161. ' Instantiate script helper object
  162. Set oScriptHelper = CreateObject("Microsoft.IIsScriptHelper")
  163. If Err.Number <> 0 Then
  164. WScript.Echo L_ScriptHelper_ErrorMessage
  165. WScript.Echo L_ChkScpHelperReg_ErrorMessage
  166. WScript.Quit(ERR_GENERAL_FAILURE)
  167. End If
  168. Set oScriptHelper.ScriptHost = WScript
  169. ' Check if we are being run with cscript.exe instead of wscript.exe
  170. oScriptHelper.CheckScriptEngine
  171. ' Command Line parsing
  172. Dim argObj, arg
  173. Set argObj = WScript.Arguments
  174. strCmdLineOptions = "[server:s:1;user:u:1;password:p:1];enapp::1;listapp::0;adddep::n;" &_
  175. "rmdep::n;enext::1;disext::n;listext::0;enfile::1;disfile::1;addfile::5;" &_
  176. "rmfile::1;listfile::0"
  177. Set oError = oScriptHelper.ParseCmdLineOptions(strCmdLineOptions)
  178. If Not oError Is Nothing Then
  179. If oError.ErrorCode = oScriptHelper.ERROR_NOT_ENOUGH_ARGS Then
  180. ' Not enough arguments for a specified switch
  181. WScript.Echo L_NotEnoughParams_ErrorMessage
  182. WScript.Echo L_SeeHelp_Message
  183. Else
  184. ' Invalid switch
  185. oCmdLib.vbPrintf L_InvalidSwitch_ErrorMessage, Array(oError.SwitchName)
  186. WScript.Echo L_SeeHelp_Message
  187. End If
  188. WScript.Quit(ERR_GENERAL_FAILURE)
  189. End If
  190. If oScriptHelper.GlobalHelpRequested Then
  191. DisplayHelpMessage
  192. WScript.Quit(ERR_OK)
  193. End If
  194. For Each arg In oScriptHelper.Switches
  195. Select Case arg
  196. Case "server"
  197. ' Server information
  198. strServer = oScriptHelper.GetSwitch(arg)
  199. Case "user"
  200. ' User information
  201. strUser = oScriptHelper.GetSwitch(arg)
  202. Case "password"
  203. ' Password information
  204. strPassword = oScriptHelper.GetSwitch(arg)
  205. Case "enapp"
  206. If (intOperation <> 0) Then
  207. WScript.Echo L_OnlyOneOper_ErrorMessage
  208. WScript.Echo L_SeeHelp_Message
  209. WScript.Quit(ERR_GENERAL_FAILURE)
  210. End If
  211. intOperation = OPER_ENAPP
  212. If oScriptHelper.IsHelpRequested(arg) Then
  213. ' display enapp specific help
  214. End If
  215. strAppName = oScriptHelper.GetSwitch(arg)
  216. Case "adddep"
  217. If (intOperation <> 0) Then
  218. WScript.Echo L_OnlyOneOper_ErrorMessage
  219. WScript.Echo L_SeeHelp_Message
  220. WScript.Quit(ERR_GENERAL_FAILURE)
  221. End If
  222. intOperation = OPER_ADDDP
  223. If oScriptHelper.IsHelpRequested(arg) Then
  224. ' display enapp specific help
  225. End If
  226. aArgs = oScriptHelper.GetSwitch(arg)
  227. If UBound(aArgs) = -1 Then
  228. WScript.Echo L_NotEnoughParams_ErrorMessage
  229. WScript.Echo L_SeeHelp_Message
  230. WScript.Quit(ERR_GENERAL_FAILURE)
  231. End If
  232. Case "rmdep"
  233. If (intOperation <> 0) Then
  234. WScript.Echo L_OnlyOneOper_ErrorMessage
  235. WScript.Echo L_SeeHelp_Message
  236. WScript.Quit(ERR_GENERAL_FAILURE)
  237. End If
  238. intOperation = OPER_REMDP
  239. If oScriptHelper.IsHelpRequested(arg) Then
  240. ' display enapp specific help
  241. End If
  242. aArgs = oScriptHelper.GetSwitch(arg)
  243. If UBound(aArgs) = -1 Then
  244. WScript.Echo L_NotEnoughParams_ErrorMessage
  245. WScript.Echo L_SeeHelp_Message
  246. WScript.Quit(ERR_GENERAL_FAILURE)
  247. End If
  248. Case "enext"
  249. If (intOperation <> 0) Then
  250. WScript.Echo L_OnlyOneOper_ErrorMessage
  251. WScript.Echo L_SeeHelp_Message
  252. WScript.Quit(ERR_GENERAL_FAILURE)
  253. End If
  254. intOperation = OPER_ENEXT
  255. If oScriptHelper.IsHelpRequested(arg) Then
  256. ' display enapp specific help
  257. End If
  258. strAppName = oScriptHelper.GetSwitch(arg)
  259. Case "disfile"
  260. If (intOperation <> 0) Then
  261. WScript.Echo L_OnlyOneOper_ErrorMessage
  262. WScript.Echo L_SeeHelp_Message
  263. WScript.Quit(ERR_GENERAL_FAILURE)
  264. End If
  265. intOperation = OPER_DSEFI
  266. If oScriptHelper.IsHelpRequested(arg) Then
  267. ' display enapp specific help
  268. End If
  269. strAppName = oScriptHelper.GetSwitch(arg)
  270. Case "enfile"
  271. If (intOperation <> 0) Then
  272. WScript.Echo L_OnlyOneOper_ErrorMessage
  273. WScript.Echo L_SeeHelp_Message
  274. WScript.Quit(ERR_GENERAL_FAILURE)
  275. End If
  276. intOperation = OPER_ENEFI
  277. If oScriptHelper.IsHelpRequested(arg) Then
  278. ' display enapp specific help
  279. End If
  280. strAppName = oScriptHelper.GetSwitch(arg)
  281. Case "disext"
  282. If (intOperation <> 0) Then
  283. WScript.Echo L_OnlyOneOper_ErrorMessage
  284. WScript.Echo L_SeeHelp_Message
  285. WScript.Quit(ERR_GENERAL_FAILURE)
  286. End If
  287. intOperation = OPER_DSEXT
  288. If oScriptHelper.IsHelpRequested(arg) Then
  289. ' display enapp specific help
  290. End If
  291. aArgs = oScriptHelper.GetSwitch(arg)
  292. Case "addfile"
  293. If (intOperation <> 0) Then
  294. WScript.Echo L_OnlyOneOper_ErrorMessage
  295. WScript.Echo L_SeeHelp_Message
  296. WScript.Quit(ERR_GENERAL_FAILURE)
  297. End If
  298. intOperation = OPER_ADEFI
  299. If oScriptHelper.IsHelpRequested(arg) Then
  300. ' display addfile specific help
  301. DisplayAddFileHelp
  302. WScript.Quit(ERR_OK)
  303. End If
  304. aArgs = oScriptHelper.GetSwitch(arg)
  305. Case "rmfile"
  306. If (intOperation <> 0) Then
  307. WScript.Echo L_OnlyOneOper_ErrorMessage
  308. WScript.Echo L_SeeHelp_Message
  309. WScript.Quit(ERR_GENERAL_FAILURE)
  310. End If
  311. intOperation = OPER_RMEFI
  312. If oScriptHelper.IsHelpRequested(arg) Then
  313. ' display enapp specific help
  314. End If
  315. strAppName = oScriptHelper.GetSwitch(arg)
  316. Case "listapp"
  317. If (intOperation <> 0) Then
  318. WScript.Echo L_OnlyOneOper_ErrorMessage
  319. WScript.Echo L_SeeHelp_Message
  320. WScript.Quit(ERR_GENERAL_FAILURE)
  321. End If
  322. intOperation = OPER_LSAPP
  323. If oScriptHelper.IsHelpRequested(arg) Then
  324. ' display enapp specific help
  325. End If
  326. Case "listext"
  327. If (intOperation <> 0) Then
  328. WScript.Echo L_OnlyOneOper_ErrorMessage
  329. WScript.Echo L_SeeHelp_Message
  330. WScript.Quit(ERR_GENERAL_FAILURE)
  331. End If
  332. intOperation = OPER_LSEXT
  333. If oScriptHelper.IsHelpRequested(arg) Then
  334. ' display enapp specific help
  335. End If
  336. Case "listfile"
  337. If (intOperation <> 0) Then
  338. WScript.Echo L_OnlyOneOper_ErrorMessage
  339. WScript.Echo L_SeeHelp_Message
  340. WScript.Quit(ERR_GENERAL_FAILURE)
  341. End If
  342. intOperation = OPER_LSEFI
  343. If oScriptHelper.IsHelpRequested(arg) Then
  344. ' display enapp specific help
  345. End If
  346. End Select
  347. Next
  348. ' Check Parameters
  349. If intOperation = 0 Then
  350. WScript.Echo L_SeeHelp_Message
  351. WScript.Quit(ERR_GENERAL_FAILURE)
  352. End If
  353. ' Check if /p is specified but /u isn't. In this case, we should bail out with an error
  354. If oScriptHelper.Switches.Exists("password") And Not oScriptHelper.Switches.Exists("user") Then
  355. WScript.Echo L_PassWithoutUser_ErrorMessage
  356. WScript.Quit(ERR_GENERAL_FAILURE)
  357. End If
  358. ' Check if /u is specified but /p isn't. In this case, we should ask for a password
  359. If oScriptHelper.Switches.Exists("user") And Not oScriptHelper.Switches.Exists("password") Then
  360. strPassword = oCmdLib.GetPassword
  361. End If
  362. ' Initializes authentication with remote machine
  363. intResult = oScriptHelper.InitAuthentication(strServer, strUser, strPassword)
  364. If intResult <> 0 Then
  365. WScript.Quit(intResult)
  366. End If
  367. ' Choose operation
  368. Select Case intOperation
  369. Case OPER_ENAPP
  370. intResult = ChApp(strAppName, intOperation)
  371. If intResult=0 Then
  372. WScript.Echo(L_EnAppComplete_Message)
  373. End If
  374. Case OPER_ADDDP
  375. intResult = ChDep(aArgs, intOperation)
  376. If intResult=0 Then
  377. WScript.Echo(L_AddDpComplete_Message)
  378. End If
  379. Case OPER_REMDP
  380. intResult = ChDep(aArgs, intOperation)
  381. If intResult=0 Then
  382. WScript.Echo(L_RemDpComplete_Message)
  383. End If
  384. Case OPER_ENEXT
  385. intResult = ChApp(strAppName, intOperation)
  386. If intResult=0 Then
  387. WScript.Echo(L_EnExtComplete_Message)
  388. End If
  389. Case OPER_ENEFI
  390. intResult = ChApp(strAppName, intOperation)
  391. If intResult=0 Then
  392. WScript.Echo(L_EnEfiComplete_Message)
  393. End If
  394. Case OPER_DSEFI
  395. intResult = ChApp(strAppName, intOperation)
  396. If intResult=0 Then
  397. WScript.Echo(L_DsEfiComplete_Message)
  398. End If
  399. Case OPER_DSEXT
  400. intResult = DsExt(aArgs)
  401. If intResult=0 Then
  402. WScript.Echo(L_DsExtComplete_Message)
  403. End If
  404. Case OPER_ADEFI
  405. intResult = ChDep(aArgs, intOperation)
  406. If intResult=0 Then
  407. WScript.Echo(L_AdEFiComplete_Message)
  408. End If
  409. Case OPER_RMEFI
  410. intResult = RmEfi(strAppName)
  411. If intResult=0 Then
  412. WScript.Echo(L_RmEFiComplete_Message)
  413. End If
  414. Case OPER_LSAPP
  415. intResult = ShowList(intOperation)
  416. Case OPER_LSEXT
  417. intResult = ShowList(intOperation)
  418. Case OPER_LSEFI
  419. intResult = ShowListFile()
  420. End Select
  421. ' Return value to command processor
  422. WScript.Quit(intResult)
  423. '''''''''''''''''''''''''
  424. ' End Of Main Block
  425. '''''''''''''''''''''
  426. '''''''''''''''''''''''''''
  427. ' DisplayHelpMessage
  428. '''''''''''''''''''''''''''
  429. Sub DisplayHelpMessage()
  430. WScript.Echo L_Help_HELP_General01_Text
  431. WScript.Echo L_Empty_Text
  432. WScript.Echo L_Help_HELP_General02_Text
  433. WScript.Echo L_Help_HELP_General02a_Text
  434. WScript.Echo L_Help_HELP_General03_Text
  435. WScript.Echo L_Help_HELP_General04_Text
  436. WScript.Echo L_Empty_Text
  437. WScript.Echo L_Help_HELP_General05_Text
  438. WScript.Echo L_Empty_Text
  439. WScript.Echo L_Help_HELP_General06_Text
  440. WScript.Echo L_Help_HELP_General06a_Text
  441. WScript.Echo L_Help_HELP_General06b_Text
  442. WScript.Echo L_Help_HELP_General06c_Text
  443. WScript.Echo L_Help_HELP_General06d_Text
  444. WScript.Echo L_Help_HELP_General06e_Text
  445. WScript.Echo L_Help_HELP_General07_Text
  446. WScript.Echo L_Help_HELP_General07a_Text
  447. WScript.Echo L_Help_HELP_General08_Text
  448. WScript.Echo L_Help_HELP_General08a_Text
  449. WScript.Echo L_Help_HELP_General09_Text
  450. WScript.Echo L_Help_HELP_General09a_Text
  451. WScript.Echo L_Help_HELP_General09b_Text
  452. WScript.Echo L_Help_HELP_General09c_Text
  453. WScript.Echo L_Help_HELP_General09d_Text
  454. WScript.Echo L_Help_HELP_General10_Text
  455. WScript.Echo L_Help_HELP_General10a_Text
  456. WScript.Echo L_Help_HELP_General10b_Text
  457. WScript.Echo L_Help_HELP_General10c_Text
  458. WScript.Echo L_Help_HELP_General10d_Text
  459. WScript.Echo L_Help_HELP_General11_Text
  460. WScript.Echo L_Help_HELP_General11a_Text
  461. WScript.Echo L_Help_HELP_General11b_Text
  462. WScript.Echo L_Help_HELP_General12_Text
  463. WScript.Echo L_Help_HELP_General12a_Text
  464. WScript.Echo L_Help_HELP_General12b_Text
  465. WScript.Echo L_Help_HELP_General13_Text
  466. WScript.Echo L_Help_HELP_General13a_Text
  467. WScript.Echo L_Help_HELP_General14_Text
  468. WScript.Echo L_Help_HELP_General14a_Text
  469. WScript.Echo L_Help_HELP_General15_Text
  470. WScript.Echo L_Help_HELP_General15a_Text
  471. WScript.Echo L_Help_HELP_General16_Text
  472. WScript.Echo L_Help_HELP_General16a_Text
  473. WScript.Echo L_Help_HELP_General17_Text
  474. WScript.Echo L_Help_HELP_General17a_Text
  475. WScript.Echo L_Help_HELP_General18_Text
  476. WScript.Echo L_Help_HELP_General19_Text
  477. End Sub
  478. '''''''''''''''''''''''''''
  479. ' DisplayHelpMessage
  480. '''''''''''''''''''''''''''
  481. Sub DisplayAddFileHelp()
  482. WScript.Echo L_Help_HELP_AddFile01_Text
  483. WScript.Echo L_Empty_Text
  484. WScript.Echo L_Help_HELP_AddFile02_Text
  485. WScript.Echo L_Help_HELP_AddFile02a_Text
  486. WScript.Echo L_Help_HELP_AddFile03_Text
  487. WScript.Echo L_Empty_Text
  488. WScript.Echo L_Help_HELP_General05_Text
  489. WScript.Echo L_Empty_Text
  490. WScript.Echo L_Help_HELP_General06_Text
  491. WScript.Echo L_Help_HELP_General06a_Text
  492. WScript.Echo L_Help_HELP_General06b_Text
  493. WScript.Echo L_Help_HELP_General06c_Text
  494. WScript.Echo L_Help_HELP_General06d_Text
  495. WScript.Echo L_Help_HELP_General06e_Text
  496. WScript.Echo L_Help_HELP_AddFile07_Text
  497. WScript.Echo L_Help_HELP_AddFile08_Text
  498. WScript.Echo L_Help_HELP_AddFile09_Text
  499. WScript.Echo L_Help_HELP_AddFile09a_Text
  500. WScript.Echo L_Help_HELP_AddFile09b_Text
  501. WScript.Echo L_Help_HELP_AddFile09c_Text
  502. WScript.Echo L_Help_HELP_AddFile10_Text
  503. WScript.Echo L_Help_HELP_AddFile10a_Text
  504. WScript.Echo L_Help_HELP_AddFile11_Text
  505. WScript.Echo L_Help_HELP_AddFile11a_Text
  506. WScript.Echo L_Help_HELP_AddFile11b_Text
  507. WScript.Echo L_Help_HELP_AddFile12_Text
  508. WScript.Echo L_Help_HELP_AddFile12a_Text
  509. WScript.Echo L_Help_HELP_AddFile13_Text
  510. WScript.Echo L_Help_HELP_AddFile13a_Text
  511. WScript.Echo L_Help_HELP_AddFile14_Text
  512. WScript.Echo L_Help_HELP_AddFile14a_Text
  513. WScript.Echo L_Help_HELP_AddFile15_Text
  514. WScript.Echo L_Help_HELP_AddFile15a_Text
  515. WScript.Echo L_Help_HELP_AddFile16_Text
  516. WScript.Echo L_Help_HELP_AddFile16a_Text
  517. End Sub
  518. Function ChApp(strAppName, intOperation)
  519. Dim WebSvcObj
  520. On Error Resume Next
  521. oScriptHelper.WMIConnect
  522. If Err.Number Then
  523. WScript.Echo L_WMIConnect_ErrorMessage
  524. oCmdLib.vbPrintf L_Error_ErrorMessage, Array(Hex(Err.Number), Err.Description)
  525. ChApp = Err.Number
  526. Exit Function
  527. End If
  528. Set WebSvcObj = oScriptHelper.ProviderObj.get("IIsWebService='w3svc'")
  529. If Err.Number Then
  530. Select Case Err.Number
  531. Case &H80070005
  532. WScript.Echo L_Admin_ErrorMessage
  533. WScript.Echo L_Adminp2_ErrorMessage
  534. Case Else
  535. WScript.Echo L_GetWebSvcObj_ErrorMessage
  536. oCmdLib.vbPrintf L_Error_ErrorMessage, Array(Hex(Err.Number), Err.Description)
  537. End Select
  538. ChApp = Err.Number
  539. Exit Function
  540. End If
  541. Select Case intOperation
  542. Case OPER_ENAPP
  543. WebSvcObj.EnableApplication strAppName
  544. Case OPER_ENEXT
  545. WebSvcObj.EnableWebServiceExtension strAppName
  546. Case OPER_ENEFI
  547. WebSvcObj.EnableExtensionFile strAppName
  548. Case OPER_DSEFI
  549. WebSvcObj.DisableExtensionFile strAppName
  550. End Select
  551. If Err.Number Then
  552. WScript.Echo L_EnApp_ErrorMessage
  553. WScript.Echo Err.Description
  554. Select Case intOperation
  555. Case OPER_ENAPP
  556. WScript.Echo L_NoApp_ErrorMessage
  557. WScript.Echo L_NoAppp2_ErrorMessage
  558. Case OPER_ENEXT
  559. WScript.Echo L_NoExt_ErrorMessage
  560. Case OPER_ENEFI
  561. WScript.Echo L_NoEfi_ErrorMessage
  562. Case OPER_DSEFI
  563. WScript.Echo L_NoEfi_ErrorMessage
  564. End Select
  565. ChApp = Err.Number
  566. Exit Function
  567. End If
  568. End Function
  569. Function RmEfi(strAppName)
  570. Dim WebSvcObj, extObj, restrictions, i, bDel
  571. bDel = False
  572. On Error Resume Next
  573. oScriptHelper.WMIConnect
  574. If Err.Number Then
  575. WScript.Echo L_WMIConnect_ErrorMessage
  576. oCmdLib.vbPrintf L_Error_ErrorMessage, Array(Hex(Err.Number), Err.Description)
  577. RmEfi = Err.Number
  578. Exit Function
  579. End If
  580. Set WebSvcObj = oScriptHelper.ProviderObj.get("IIsWebService='w3svc'")
  581. If Err.Number Then
  582. Select Case Err.Number
  583. Case &H80070005
  584. WScript.Echo L_Admin_ErrorMessage
  585. WScript.Echo L_Adminp2_ErrorMessage
  586. Case Else
  587. WScript.Echo L_GetWebSvcObj_ErrorMessage
  588. oCmdLib.vbPrintf L_Error_ErrorMessage, Array(Hex(Err.Number), Err.Description)
  589. End Select
  590. RmEfi = Err.Number
  591. Exit Function
  592. End If
  593. Set extObj = oScriptHelper.ProviderObj.get("IIsWebServiceSetting='w3svc'")
  594. restrictions = extObj.WebSvcExtRestrictionList
  595. For i=0 to UBOUND(restrictions)
  596. If UCASE(restrictions(i).FilePath) = UCASE(strAppName) Then
  597. If restrictions(i).Deletable = 1 Then
  598. WebSvcObj.DeleteExtensionFileRecord strAppName
  599. bDel = True
  600. End If
  601. End If
  602. Next
  603. If Err.Number Then
  604. WScript.Echo L_EnApp_ErrorMessage
  605. WScript.Echo Err.Description
  606. RmEfi = Err.Number
  607. Exit Function
  608. End If
  609. If bDel = False Then
  610. WScript.Echo L_RmEfi_ErrorMessage
  611. WScript.Echo L_RmEfip2_ErrorMessage
  612. RmEfi = 1
  613. End If
  614. End Function
  615. Function ChDep(aArgs, intOperation)
  616. Dim WebSvcObj, i
  617. On Error Resume Next
  618. oScriptHelper.WMIConnect
  619. If Err.Number Then
  620. WScript.Echo L_WMIConnect_ErrorMessage
  621. oCmdLib.vbPrintf L_Error_ErrorMessage, Array(Hex(Err.Number), Err.Description)
  622. ChDep = Err.Number
  623. Exit Function
  624. End If
  625. Set WebSvcObj = oScriptHelper.ProviderObj.get("IIsWebService='w3svc'")
  626. If Err.Number Then
  627. Select Case Err.Number
  628. Case &H80070005
  629. WScript.Echo L_Admin_ErrorMessage
  630. WScript.Echo L_Adminp2_ErrorMessage
  631. Case Else
  632. WScript.Echo L_GetWebSvcObj_ErrorMessage
  633. oCmdLib.vbPrintf L_Error_ErrorMessage, Array(Hex(Err.Number), Err.Description)
  634. End Select
  635. ChDep = Err.Number
  636. Exit Function
  637. End If
  638. If OPER_ADEFI = intOperation Then
  639. If ((aArgs(1) <> 0) And (aArgs(1) <> 1)) Then
  640. aArgs(1) = 0
  641. End If
  642. WebSvcObj.AddExtensionFile aArgs(0), aArgs(1), aArgs(2), aArgs(3), aArgs(4)
  643. Else
  644. If UBOUND(aArgs) < 1 Then
  645. WScript.Echo L_NotEnoughParams_ErrorMessage
  646. WScript.Echo L_SeeHelp_Message
  647. ChDep = ERR_GENERAL_FAILURE
  648. Exit Function
  649. End If
  650. For i=1 to UBOUND(aArgs)
  651. Select Case intOperation
  652. Case OPER_ADDDP
  653. WebSvcObj.AddDependency aArgs(0), aArgs(i)
  654. Case OPER_REMDP
  655. WebSvcObj.RemoveDependency aArgs(0), aArgs(i)
  656. End Select
  657. If Err.Number Then
  658. WScript.Echo L_EnDep_ErrorMessage
  659. WScript.Echo Err.Description
  660. WScript.Echo L_NoDep_ErrorMessage
  661. WScript.Echo L_NoDepp2_ErrorMessage
  662. ChDep = Err.Number
  663. Exit Function
  664. End If
  665. Next
  666. End If
  667. If Err.Number Then
  668. WScript.Echo L_EnApp_ErrorMessage
  669. WScript.Echo Err.Description
  670. ChDep = Err.Number
  671. Exit Function
  672. End If
  673. End Function
  674. Function DsExt(aArgs)
  675. Dim WebSvcObj, i
  676. On Error Resume Next
  677. oScriptHelper.WMIConnect
  678. If Err.Number Then
  679. WScript.Echo L_WMIConnect_ErrorMessage
  680. oCmdLib.vbPrintf L_Error_ErrorMessage, Array(Hex(Err.Number), Err.Description)
  681. DsExt = Err.Number
  682. Exit Function
  683. End If
  684. Set WebSvcObj = oScriptHelper.ProviderObj.get("IIsWebService='w3svc'")
  685. If Err.Number Then
  686. Select Case Err.Number
  687. Case &H80070005
  688. WScript.Echo L_Admin_ErrorMessage
  689. WScript.Echo L_Adminp2_ErrorMessage
  690. Case Else
  691. WScript.Echo L_GetWebSvcObj_ErrorMessage
  692. oCmdLib.vbPrintf L_Error_ErrorMessage, Array(Hex(Err.Number), Err.Description)
  693. End Select
  694. DsExt = Err.Number
  695. Exit Function
  696. End If
  697. For i=0 to UBOUND(aArgs)
  698. WebSvcObj.DisableWebServiceExtension aArgs(i)
  699. If Err.Number Then
  700. WScript.Echo L_EnApp_ErrorMessage
  701. WScript.Echo Err.Description
  702. WScript.Echo L_NoExt_ErrorMessage
  703. DsExt = Err.Number
  704. Exit Function
  705. End If
  706. Next
  707. End Function
  708. Function ShowList(intOperation)
  709. Dim WebSvcObj, holder, i, mylist
  710. On Error Resume Next
  711. oScriptHelper.WMIConnect
  712. If Err.Number Then
  713. WScript.Echo L_WMIConnect_ErrorMessage
  714. oCmdLib.vbPrintf L_Error_ErrorMessage, Array(Hex(Err.Number), Err.Description)
  715. ShowList = Err.Number
  716. Exit Function
  717. End If
  718. Set WebSvcObj = oScriptHelper.ProviderObj.get("IIsWebService='w3svc'")
  719. If Err.Number Then
  720. Select Case Err.Number
  721. Case &H80070005
  722. WScript.Echo L_Admin_ErrorMessage
  723. WScript.Echo L_Adminp2_ErrorMessage
  724. Case Else
  725. WScript.Echo L_GetWebSvcObj_ErrorMessage
  726. oCmdLib.vbPrintf L_Error_ErrorMessage, Array(Hex(Err.Number), Err.Description)
  727. End Select
  728. ShowList = Err.Number
  729. Exit Function
  730. End If
  731. Select Case intOperation
  732. Case OPER_LSAPP
  733. set holder=oScriptHelper.ProviderObj.execmethod("IIsWebService='w3svc'", "ListApplications")
  734. mylist = holder.Applications
  735. Case OPER_LSEXT
  736. set holder=oScriptHelper.ProviderObj.execmethod("IIsWebService='w3svc'", "ListWebServiceExtensions")
  737. mylist = holder.Extensions
  738. End Select
  739. If Err.Number Then
  740. WScript.Echo L_ShowList_ErrorMessage
  741. WScript.Echo L_ShowList2_ErrorMessage
  742. WScript.Echo L_ShowList3_ErrorMessage
  743. WScript.Echo Err.Description
  744. ShowList = Err.Number
  745. Exit Function
  746. End If
  747. For i = 0 to UBOUND(mylist)
  748. WScript.Echo mylist(i)
  749. Next
  750. End Function
  751. Function ShowListFile()
  752. Dim WebSvcObj, fileList, i
  753. On Error Resume Next
  754. oScriptHelper.WMIConnect
  755. If Err.Number Then
  756. WScript.Echo L_WMIConnect_ErrorMessage
  757. oCmdLib.vbPrintf L_Error_ErrorMessage, Array(Hex(Err.Number), Err.Description)
  758. ShowList = Err.Number
  759. Exit Function
  760. End If
  761. Set WebSvcObj = oScriptHelper.ProviderObj.get("IIsWebServiceSetting='w3svc'")
  762. If Err.Number Then
  763. Select Case Err.Number
  764. Case &H80070005
  765. WScript.Echo L_Admin_ErrorMessage
  766. WScript.Echo L_Adminp2_ErrorMessage
  767. Case Else
  768. WScript.Echo L_GetWebSvcObj_ErrorMessage
  769. oCmdLib.vbPrintf L_Error_ErrorMessage, Array(Hex(Err.Number), Err.Description)
  770. End Select
  771. ShowList = Err.Number
  772. Exit Function
  773. End If
  774. fileList = WebSvcObj.WebSvcExtRestrictionList
  775. If Err.Number Then
  776. WScript.Echo L_ShowList_ErrorMessage
  777. WScript.Echo L_ShowList2_ErrorMessage
  778. WScript.Echo L_ShowList3_ErrorMessage
  779. WScript.Echo Err.Description
  780. ShowList = Err.Number
  781. Exit Function
  782. End If
  783. WScript.Echo L_Empty_Text
  784. WScript.Echo L_ShowListFile_Message
  785. WScript.Echo L_ShowListFile2_Message
  786. For i = 0 to UBOUND(fileList)
  787. WScript.Echo fileList(i).Access & " " & fileList(i).FilePath
  788. Next
  789. End Function