home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 2000 November / VPR0011B.ISO / nec98 / ins1.cab / nntp_rserver.vbs < prev    next >
Text File  |  1999-12-29  |  17KB  |  521 lines

  1. REM
  2. REM LOCALIZATION
  3. REM
  4.  
  5. L_SWITCH_OPERATION      = "-t"
  6. L_SWITCH_SERVER         = "-s"
  7. L_SWITCH_INSTANCE_ID    = "-v"
  8. L_SWITCH_CL_POSTS        = "-c"
  9. L_SWITCH_CL_SOFT        = "-l"
  10. L_SWITCH_CL_HARD        = "-h"
  11. L_SWITCH_FD_POSTS        = "-f"
  12. L_SWITCH_FD_SOFT        = "-i"
  13. L_SWITCH_FD_HARD        = "-j"
  14. L_SWITCH_SMTP_SERVER    = "-m"
  15. L_SWITCH_MODERATOR_DOMAIN    = "-d"
  16. L_SWITCH_UUCP_NAME        = "-u"
  17. L_SWITCH_CTRL_MSGS        = "-x"
  18. L_SWITCH_NNTPFILE        = "-n"
  19. L_SWITCH_ADMIN_EMAIL    = "-a"
  20. L_SWITCH_PICKUP            = "-p"
  21. L_SWITCH_FAILED_PICKUP    = "-q"
  22. L_SWITCH_DROP            = "-e"
  23. L_SWITCH_NEWNEWS        = "-b"
  24. L_SWITCH_HONOR_MSGIDS    = "-r"
  25. L_SWITCH_PORT           = "-o"
  26.  
  27. L_OP_GET            = "g"
  28. L_OP_SET            = "s"
  29. L_OP_CREATE            = "c"
  30. L_OP_DELETE            = "d"
  31.  
  32. L_DESC_PROGRAM      = "rserver - Manipulate NNTP virtual servers"
  33. L_DESC_GET            = "Get NNTP virtual server properties"
  34. L_DESC_SET            = "Set NNTP virtual server properties"
  35. L_DESC_CREATE        = "Create a new NNTP virtual server"
  36. L_DESC_DELETE       = "Delete an NNTP virtual server"
  37.  
  38. L_DESC_OPERATIONS    = "<operations>"
  39. L_DESC_SERVER       = "<server> Specify computer to configure"
  40. L_DESC_INSTANCE_ID  = "<virtual server id> Specify virtual server id"
  41. L_DESC_CL_POSTS        = "<true/false> Allow client posts"
  42. L_DESC_CL_SOFT        = "soft client post limit in bytes"
  43. L_DESC_CL_HARD        = "hard client post limit in bytes"
  44. L_DESC_FD_POSTS        = "<true/false> Allow feed posts"
  45. L_DESC_FD_SOFT        = "soft feed post limit in bytes"
  46. L_DESC_FD_HARD        = "hard feed post limit in bytes"
  47. L_DESC_SMTP_SERVER    = "SMTP address for moderated posts"
  48. L_DESC_MODERATOR_DOMAIN    = "Domain name for default moderators"
  49. L_DESC_UUCP_NAME        = "UUCP name of this server"
  50. L_DESC_CTRL_MSGS        = "<true/false> Process control messages"
  51. L_DESC_NNTPFILE            = "Internal Nntp server files location"
  52. L_DESC_ADMIN_EMAIL        = "Administrator email account"
  53. L_DESC_PICKUP            = "Pickup directory"
  54. L_DESC_FAILED_PICKUP    = "Failed pickup directory"
  55. L_DESC_DROP                = "Drop directory"
  56. L_DESC_NEWNEWS            = "<true/false> Disable NEWNEWS command"
  57. L_DESC_HONOR_MSGIDS        = "<true/false> Honor client msg IDs"
  58. L_DESC_PORT             = "TCP Port for client connections"
  59.  
  60. L_DESC_EXAMPLES         = "Examples:"
  61. L_DESC_EXAMPLE1         = "rserver.vbs -t g -v 1"
  62. L_DESC_EXAMPLE2         = "rserver.vbs -t s -v 1 -c true -l 1000000 -a administrator@mydomain.com"
  63. L_DESC_EXAMPLE3         = "rserver.vbs -t d -v 3"
  64. L_DESC_EXAMPLE4         = "rserver.vbs -t c -v 2 -n c:\news_content"
  65.  
  66. L_STR_SERVER_ID            = "Virtual server ID:"
  67. L_STR_CL_POSTS            = "Allow client posting?"
  68. L_STR_CL_SOFT            = "Client soft posting limit:"
  69. L_STR_CL_HARD            = "Client hard posting limit:"
  70. L_STR_FD_POSTS            = "Allow feed posting?"
  71. L_STR_FD_SOFT            = "Feed soft posting limit:"
  72. L_STR_FD_HARD            = "Feed hard posting limit:"
  73. L_STR_SMTP_SERVER        = "Smtp server:"
  74. L_STR_MODERATOR_DOMAIN    = "Default moderator domain:"
  75. L_STR_UUCP_NAME            = "UUCP name:"
  76. L_STR_CTRL_MSGS            = "Process control messages?"
  77. L_STR_NNTPFILE            = "Nntp file location:"
  78. L_STR_ADMIN_EMAIL        = "Administrator email address:"
  79. L_STR_PICKUP            = "Pickup directory:"
  80. L_STR_FAILED_PICKUP        = "Failed pickup directory:"
  81. L_STR_DROP                = "Drop directory:"
  82. L_STR_NEWNEWS            = "Disable NEWNEWS command?"
  83. L_STR_HONOR_MSGIDS        = "Honor client message IDs?"
  84. L_STR_PORT              = "TCP Port:"
  85.  
  86. L_STR_CREATED_VS        = "Successfully created the following virtual server:"
  87.  
  88. L_ERR_INVALID_INSTANCE_ID        = "Invalid instance identifier."
  89. L_ERR_CANT_DELETE_INSTANCE_ONE    = "You can't delete the default virtual server."
  90. L_ERR_MUST_SPECIFY_NNTPFILE        = "You must specify the nntp file location."
  91. L_ERR_INVALID_PORT              = "Invalid port number."
  92.  
  93. REM
  94. REM END LOCALIZATION
  95. REM
  96.  
  97. REM
  98. REM --- Globals ---
  99. REM
  100.  
  101. dim g_dictParms
  102. dim    g_admin
  103.  
  104. set g_dictParms = CreateObject ( "Scripting.Dictionary" )
  105.  
  106. REM
  107. REM --- Set argument defaults ---
  108. REM
  109.  
  110. g_dictParms(L_SWITCH_OPERATION)        = ""
  111. g_dictParms(L_SWITCH_SERVER)        = "localhost"
  112. g_dictParms(L_SWITCH_INSTANCE_ID)    = "1"
  113. g_dictParms(L_SWITCH_CL_POSTS)        = ""
  114. g_dictParms(L_SWITCH_CL_SOFT)        = ""
  115. g_dictParms(L_SWITCH_CL_HARD)        = ""
  116. g_dictParms(L_SWITCH_FD_POSTS)        = ""
  117. g_dictParms(L_SWITCH_FD_SOFT)        = ""
  118. g_dictParms(L_SWITCH_FD_HARD)        = ""
  119. g_dictParms(L_SWITCH_SMTP_SERVER)    = ""
  120. g_dictParms(L_SWITCH_MODERATOR_DOMAIN)    = ""
  121. g_dictParms(L_SWITCH_UUCP_NAME)        = ""
  122. g_dictParms(L_SWITCH_CTRL_MSGS)        = ""
  123. g_dictParms(L_SWITCH_NNTPFILE)        = ""
  124. g_dictParms(L_SWITCH_ADMIN_EMAIL)    = ""
  125. g_dictParms(L_SWITCH_PICKUP)        = ""
  126. g_dictParms(L_SWITCH_FAILED_PICKUP)    = ""
  127. g_dictParms(L_SWITCH_DROP)            = ""
  128. g_dictParms(L_SWITCH_NEWNEWS)        = ""
  129. g_dictParms(L_SWITCH_HONOR_MSGIDS)    = ""
  130. g_dictParms(L_SWITCH_PORT)            = ""
  131.  
  132. REM
  133. REM --- Begin Main Program ---
  134. REM
  135.  
  136. if NOT ParseCommandLine ( g_dictParms, WScript.Arguments ) then
  137.     usage
  138.     WScript.Quit ( 0 )
  139. end if
  140.  
  141. REM
  142. REM    Debug: print out command line arguments:
  143. REM
  144. REM switches = g_dictParms.keys
  145. REM args = g_dictParms.items
  146. REM
  147. REM
  148. REM for i = 0 to g_dictParms.Count - 1
  149. REM     WScript.echo switches(i) & " = " & args(i)
  150. REM next
  151. REM
  152.  
  153. server = g_dictParms(L_SWITCH_SERVER)
  154. instance = g_dictParms(L_SWITCH_INSTANCE_ID)
  155.  
  156. if NOT IsNumeric (instance) then
  157.     WScript.Echo L_ERR_INVALID_INSTANCE_ID
  158.     WScript.Quit 0
  159. end if
  160.  
  161. select case g_dictParms(L_SWITCH_OPERATION)
  162. case L_OP_GET
  163.     On Error Resume Next
  164.     set g_admin = CreateAdsiObject ( server, instance )
  165.    if ( Err.Number <> 0 ) then
  166.     Wscript.echo Err.Number
  167.         WScript.echo "Error Getting Instance"
  168.     else     
  169.     PrintVirtualServer g_admin
  170.     end if
  171.  
  172. case L_OP_SET
  173.     On Error Resume Next
  174.     set g_admin = CreateAdsiObject ( server, instance )
  175.    if ( Err.Number <> 0 ) then
  176.     Wscript.echo Err.Number
  177.         WScript.echo "Error Setting Instance"
  178.     else     
  179.     SetProperties ( g_admin )
  180.     end if
  181.  
  182.  
  183.    On Error Resume Next
  184.     g_admin.SetInfo
  185.     if ( Err.Number <> 0 ) then
  186.         WScript.echo " Error Setting Info: " & Err.Description & "(" & Err.Number & ")"
  187.     else 
  188.         PrintVirtualServer g_admin
  189.     end if
  190.  
  191.    On Error Resume Next
  192.     g_admin.GetInfo
  193.     if ( Err.Number <> 0 ) then
  194.         WScript.echo " Error Getting Info: " & Err.Description & "(" & Err.Number & ")"
  195.     else 
  196.         PrintVirtualServer g_admin
  197.     end if
  198.  
  199. case L_OP_CREATE
  200.  
  201.     dim strNntpFile
  202.  
  203.     strNntpFile = g_dictParms ( L_SWITCH_NNTPFILE )
  204.  
  205.     if strNntpFile = "" then
  206.         WScript.Echo L_ERR_MUST_SPECIFY_NNTPFILE
  207.         WScript.Quit 0
  208.     end if
  209.  
  210.     set g_admin = CreateAdsiObject ( server, "" )
  211.  
  212.    On Error Resume Next
  213.     set newinst = g_admin.Create ( "IIsNntpServer", instance )
  214.    if ( Err.Number <> 0 ) then
  215.     Wscript.echo Err.Number
  216.         WScript.echo "Error Setting New Instance"
  217.     else 
  218.         PrintVirtualServer g_admin
  219.  
  220.  
  221.     newinst.Put "ServerBindings", ":119:"
  222.     newinst.Put "NewsPickupDirectory", strNntpFile & "\Pickup" 
  223.     newinst.Put "NewsFailedPickupDirectory", strNntpFile & "\FailedPickup"
  224.     newinst.Put "NewsDropDirectory", strNntpFile & "\Drop"
  225.     SetProperties ( newinst )
  226.  
  227.     newinst.SetInfo
  228.  
  229.     set newvroot = newinst.Create ( "IIsNntpVirtualDir", "Root" )
  230.  
  231.     newvroot.SetInfo
  232.     newvroot.Put "Path", strNntpFile & "\root"
  233.     newvroot.Put "AccessFlags", 3
  234.     newvroot.SetInfo
  235.  
  236.     WScript.Echo L_STR_CREATED_VS
  237.     PrintVirtualServer newinst
  238.    end if
  239.  
  240. case L_OP_DELETE
  241.     set g_admin = CreateAdsiObject ( server, "" )
  242.  
  243.     if instance = 1 then
  244.         WScript.Echo L_ERR_CANT_DELETE_INSTANCE_ONE
  245.         WScript.Quit 0
  246.     end if
  247.  
  248.    On Error Resume Next
  249.     g_admin.Delete "IIsNntpServer", instance
  250.     if ( Err.Number <> 0 ) then
  251.         WScript.echo " Error Deleting Info: " & Err.Description & "(" & Err.Number & ")"
  252.     else 
  253.         PrintVirtualServer g_admin
  254.     end if
  255.  
  256. case else
  257.     usage
  258.  
  259. end select
  260.  
  261. WScript.Quit 0
  262.  
  263. REM
  264. REM --- End Main Program ---
  265. REM
  266.  
  267. REM
  268. REM ParseCommandLine ( dictParameters, cmdline )
  269. REM     Parses the command line parameters into the given dictionary
  270. REM
  271. REM Arguments:
  272. REM     dictParameters  - A dictionary containing the global parameters
  273. REM     cmdline - Collection of command line arguments
  274. REM
  275. REM Returns - Success code
  276. REM
  277.  
  278. Function ParseCommandLine ( dictParameters, cmdline )
  279.     dim     fRet
  280.     dim     cArgs
  281.     dim     i
  282.     dim     strSwitch
  283.     dim     strArgument
  284.  
  285.     fRet    = TRUE
  286.     cArgs   = cmdline.Count
  287.     i       = 0
  288.     
  289.     do while (i < cArgs)
  290.  
  291.         REM
  292.         REM Parse the switch and its argument
  293.         REM
  294.  
  295.         if i + 1 >= cArgs then
  296.             REM
  297.             REM Not enough command line arguments - Fail
  298.             REM
  299.  
  300.             fRet = FALSE
  301.             exit do
  302.         end if
  303.  
  304.         strSwitch = cmdline(i)
  305.         i = i + 1
  306.  
  307.         strArgument = cmdline(i)
  308.         i = i + 1
  309.  
  310.         REM
  311.         REM Add the switch,argument pair to the dictionary
  312.         REM
  313.  
  314.         if NOT dictParameters.Exists ( strSwitch ) then
  315.             REM
  316.             REM Bad switch - Fail
  317.             REM
  318.  
  319.             fRet = FALSE
  320.             exit do
  321.         end if 
  322.  
  323.         dictParameters(strSwitch) = strArgument
  324.  
  325.     loop
  326.  
  327.     ParseCommandLine = fRet
  328. end function
  329.  
  330. REM
  331. REM Usage ()
  332. REM     prints out the description of the command line arguments
  333. REM
  334.  
  335. Sub Usage
  336.  
  337.     WScript.Echo L_DESC_PROGRAM
  338.     WScript.Echo vbTab & L_SWITCH_OPERATION & " " & L_DESC_OPERATIONS
  339.     WScript.Echo vbTab & vbTab & L_OP_GET & vbTab & L_DESC_GET
  340.     WScript.Echo vbTab & vbTab & L_OP_SET & vbTab & L_DESC_SET
  341.     WScript.Echo vbTab & vbTab & L_OP_CREATE & vbTab & L_DESC_CREATE
  342.     WScript.Echo vbTab & vbTab & L_OP_DELETE & vbTab & L_DESC_DELETE
  343.     WScript.Echo vbTab & L_SWITCH_SERVER & " " & L_DESC_SERVER
  344.     WScript.Echo vbTab & L_SWITCH_INSTANCE_ID & " " & L_DESC_INSTANCE_ID
  345.     WScript.Echo vbTab & L_SWITCH_CL_POSTS & " " & L_DESC_CL_POSTS
  346.     WScript.Echo vbTab & L_SWITCH_CL_SOFT & " " & L_DESC_CL_SOFT
  347.     WScript.Echo vbTab & L_SWITCH_CL_HARD & " " & L_DESC_CL_HARD
  348.     WScript.Echo vbTab & L_SWITCH_FD_POSTS & " " & L_DESC_FD_POSTS
  349.     WScript.Echo vbTab & L_SWITCH_FD_SOFT & " " & L_DESC_FD_SOFT
  350.     WScript.Echo vbTab & L_SWITCH_FD_HARD & " " & L_DESC_FD_HARD
  351.     WScript.Echo vbTab & L_SWITCH_SMTP_SERVER & " " & L_DESC_SMTP_SERVER
  352.     WScript.Echo vbTab & L_SWITCH_MODERATOR_DOMAIN & " " & L_DESC_MODERATOR_DOMAIN
  353.     WScript.Echo vbTab & L_SWITCH_UUCP_NAME & " " & L_DESC_UUCP_NAME
  354.     WScript.Echo vbTab & L_SWITCH_CTRL_MSGS & " " & L_DESC_CTRL_MSGS
  355.     WScript.Echo vbTab & L_SWITCH_NNTPFILE & " " & L_DESC_NNTPFILE
  356.     WScript.Echo vbTab & L_SWITCH_ADMIN_EMAIL & " " & L_DESC_ADMIN_EMAIL
  357.     WScript.Echo vbTab & L_SWITCH_PICKUP & " " & L_DESC_PICKUP
  358.     WScript.Echo vbTab & L_SWITCH_FAILED_PICKUP & " " & L_DESC_FAILED_PICKUP
  359.     WScript.Echo vbTab & L_SWITCH_DROP & " " & L_DESC_DROP
  360.     WScript.Echo vbTab & L_SWITCH_NEWNEWS & " " & L_DESC_NEWNEWS
  361.     WScript.Echo vbTab & L_SWITCH_HONOR_MSGIDS & " " & L_DESC_HONOR_MSGIDS
  362.     WScript.Echo vbTab & L_SWITCH_PORT & " " & L_DESC_PORT
  363.  
  364.     WScript.Echo
  365.     WScript.Echo L_DESC_EXAMPLES
  366.     WScript.Echo L_DESC_EXAMPLE1
  367.     WScript.Echo L_DESC_EXAMPLE2
  368.     WScript.Echo L_DESC_EXAMPLE3
  369.  
  370. end sub
  371.  
  372. Sub PrintVirtualServer ( admobj )
  373.  
  374.     dim strNntpFile
  375.  
  376.     strNntpFile = admobj.Get ( "ArticleTableFile" )
  377.  
  378.     WScript.Echo L_STR_SERVER_ID & " " & admobj.Name
  379.     WScript.Echo L_STR_CL_POSTS & " " & admobj.Get ( "AllowClientPosts" )
  380.     WScript.Echo L_STR_CL_SOFT & " " & admobj.Get ( "ClientPostSoftLimit" )
  381.     WScript.Echo L_STR_CL_HARD & " " & admobj.Get ( "ClientPostHardLimit" )
  382.     WScript.Echo L_STR_FD_POSTS & " " & admobj.Get ( "AllowFeedPosts" )
  383.     WScript.Echo L_STR_FD_SOFT & " " & admobj.Get ( "FeedPostSoftLimit" )
  384.     WScript.Echo L_STR_FD_HARD & " " & admobj.Get ( "FeedPostHardLimit" )
  385.     WScript.Echo L_STR_SMTP_SERVER & " " & admobj.Get ( "SmtpServer" )
  386.     WScript.Echo L_STR_MODERATOR_DOMAIN & " " & admobj.Get ( "DefaultModeratorDomain" )
  387.     WScript.Echo L_STR_UUCP_NAME & " " & admobj.Get ( "NntpUucpName" )
  388.     WScript.Echo L_STR_CTRL_MSGS & " " & admobj.Get ( "AllowControlMsgs" )
  389.     WScript.Echo L_STR_ADMIN_EMAIL & " " & admobj.Get ( "AdminEmail" )
  390.     WScript.Echo L_STR_PICKUP & " " & admobj.Get ( "NewsPickupDirectory" )
  391.     WScript.Echo L_STR_FAILED_PICKUP & " " & admobj.Get ( "NewsFailedPickupDirectory" )
  392.     WScript.Echo L_STR_DROP & " " & admobj.Get ( "NewsDropDirectory" )
  393.     WScript.Echo L_STR_NEWNEWS & " " & admobj.Get ( "DisableNewnews" )
  394.     WScript.Echo L_STR_HONOR_MSGIDS & " " & admobj.Get ( "HonorClientMsgIds" )
  395.     WScript.Echo L_STR_NNTPFILE & " " & StripFileNameFromPath ( strNntpFile )
  396.     WScript.Echo L_STR_PORT & " " & ExtractPortFromBinding ( admobj.Get ( "ServerBindings") ( 0 ) )
  397.  
  398. end sub
  399.  
  400. Sub SetProperties ( admobj )
  401.  
  402.     SetProp admobj, g_dictParms(L_SWITCH_CL_POSTS), "AllowClientPosts", TRUE
  403.     SetProp admobj, g_dictParms(L_SWITCH_CL_SOFT), "ClientPostSoftLimit", FALSE
  404.     SetProp admobj, g_dictParms(L_SWITCH_CL_HARD), "ClientPostHardLimit", FALSE
  405.     SetProp admobj, g_dictParms(L_SWITCH_FD_POSTS), "AllowFeedPosts", TRUE
  406.     SetProp admobj, g_dictParms(L_SWITCH_FD_SOFT), "FeedPostSoftLimit", FALSE
  407.     SetProp admobj, g_dictParms(L_SWITCH_FD_HARD), "FeedPostHardLimit", FALSE
  408.     SetProp admobj, g_dictParms(L_SWITCH_SMTP_SERVER), "SmtpServer", FALSE
  409.     SetProp admobj, g_dictParms(L_SWITCH_MODERATOR_DOMAIN), "DefaultModeratorDomain", FALSE
  410.     SetProp admobj, g_dictParms(L_SWITCH_UUCP_NAME), "NntpUucpName", FALSE
  411.     SetProp admobj, g_dictParms(L_SWITCH_CTRL_MSGS), "AllowControlMsgs", TRUE
  412.     SetProp admobj, g_dictParms(L_SWITCH_ADMIN_EMAIL), "AdminEmail", FALSE
  413.     SetProp admobj, g_dictParms(L_SWITCH_PICKUP), "NewsPickupDirectory", FALSE
  414.     SetProp admobj, g_dictParms(L_SWITCH_FAILED_PICKUP), "NewsFailedPickupDirectory", FALSE
  415.     SetProp admobj, g_dictParms(L_SWITCH_DROP), "NewsDropDirectory", FALSE
  416.     SetProp admobj, g_dictParms(L_SWITCH_NEWNEWS), "DisableNewnews", TRUE
  417.     SetProp admobj, g_dictParms(L_SWITCH_HONOR_MSGIDS), "HonorClientMsgIds", TRUE
  418.     dim port
  419.     dim bindings
  420.     dim IpAddress
  421.  
  422.     port = g_dictParms(L_SWITCH_PORT)
  423.     if port <> "" then
  424.         if NOT IsNumeric ( port ) then
  425.             WScript.Echo L_ERR_INVALID_PORT
  426.             WScript.Quit 0
  427.         end if
  428.  
  429.         bindings    = admobj.GetEx ( "ServerBindings" )
  430.         if IsEmpty ( bindings ) then
  431.             bindings = Array ( "" )
  432.             IpAddress = ""
  433.         else
  434.             IpAddress = ExtractIpAddressFromBinding ( bindings(0) )
  435.         end if 
  436.         bindings(0) = IpAddress & ":" & port & ":"
  437.         admobj.PutEx 2, "ServerBindings", bindings
  438.     end if
  439.  
  440.     dim strNntpFile
  441.  
  442.     strNntpFile = g_dictParms ( L_SWITCH_NNTPFILE )
  443.  
  444.     if strNntpFile <> "" then
  445.         SetProp admobj, strNntpFile & "\descrip.txt", "GroupHelpFile", FALSE
  446.         SetProp admobj, strNntpFile & "\group.lst", "GroupListFile", FALSE
  447.         SetProp admobj, strNntpFile & "\article.hsh", "ArticleTableFile", FALSE
  448.         SetProp admobj, strNntpFile & "\history.hsh", "HistoryTableFile", FALSE
  449.         SetProp admobj, strNntpFile & "\moderatr.txt", "ModeratorFile", FALSE
  450.         SetProp admobj, strNntpFile & "\xover.hsh", "XoverTableFile", FALSE
  451.         SetProp admobj, strNntpFile & "\prettynm.txt", "PrettyNamesFile", FALSE
  452.     end if
  453.  
  454. end sub
  455.  
  456. sub SetProp ( admobj, value, prop, isbool )
  457.  
  458.     REM
  459.     REM Debug code: print out the setting of values:
  460.     REM
  461.     REM WScript.Echo "Setting " & prop & " = " & value
  462.     REM
  463.  
  464.     if value <> "" then
  465.  
  466.         if isbool then
  467.             admobj.Put prop, CBool (value)
  468.         else
  469.             admobj.Put prop, (value)
  470.         end if
  471.  
  472.     end if
  473.  
  474. end sub
  475.  
  476. Function CreateAdsiObject ( strMachine, dwInstance )
  477.  
  478.     dim strObject
  479.     dim obj
  480.  
  481.     if dwInstance <> "" then
  482.         strObject = "IIS://" & strMachine & "/NntpSvc/" & dwInstance
  483.     else
  484.         strObject = "IIS://" & strMachine & "/NntpSvc"
  485.     end if
  486.     
  487.     On Error Resume Next
  488.     set CreateAdsiObject = GetObject ( strObject )
  489.         if ( Err.Number <> 0 ) then
  490.         WScript.echo " Error Getting Info: " & Err.Description & "(" & Err.Number & ")"
  491.     else 
  492.         REM PrintVirtualServer g_admin
  493.     end if
  494.  
  495. end function
  496.  
  497. Function StripFileNameFromPath ( strPath )
  498.  
  499.     dim    i
  500.  
  501.     i = InStrRev ( strPath, "\" )
  502.     StripFileNameFromPath = Left ( strPath, i - 1 )
  503.  
  504. end function
  505.  
  506. Function ExtractPortFromBinding ( strBinding )
  507.     dim SplitArray
  508.  
  509.     SplitArray = split ( strBinding, ":" )
  510.     ExtractPortFromBinding = SplitArray ( 1 )
  511. end function
  512.  
  513. Function ExtractIpAddressFromBinding ( strBinding )
  514.     dim SplitArray
  515.  
  516.     SplitArray = split ( strBinding, ":" )
  517.     ExtractIpAddressFromBinding = SplitArray ( 0 )
  518. end function
  519.  
  520.  
  521.