'
' Test IConfigureYourServer::IsServiceInstalled
'

option explicit



// this is a Visual Basic Script "Template", used in conjunction with the
// MS Visual C++ Preprocessor to overcome some of the source management
// limitations of VBScript.  Not perfect, but better than a stick in the eye.
//
// use cl /EP foo.vbt > foo.vbs to expand the template

const SCRIPT_FILENAME    = "test-IsServiceInstalled.vbs"
const SCRIPT_SOURCE_NAME = __FILE__
const SCRIPT_DATE        = __DATE__
const SCRIPT_TIME        = __TIME__


// this is all our common code.

#include "common.vbi"



Main
wscript.quit(0)


sub Main
   On Error Resume Next

   Dim srvwiz
   Set srvwiz = CreateObject("ServerAdmin.ConfigureYourServer")


   Dim services(6) 
   services(0) = "DNS"
   services(1) = "DHCP"
   services(2) = "RRAS"
   services(3) = "WINS"
   services(4) = "IIS"
   services(5) = "StreamingMedia"
   services(6) = "MessageQueue"

   Dim i
   Dim j
   For i = 0 to Ubound(services)
      Err.Clear
      j = srvWiz.IsServiceInstalled(services(i))
      If Err.Number then DumpErrAndQuit

      Echo j
      Select case j
         case 0
            Echo services(i) & " is not installed"
         case 1
            Echo services(i) & " is installed"
         case NEG_ONE
            Echo services(i) & " cannot be installed on this OS"
         case else
            Echo services(i) & " incomprehensible response"
      End select   
   Next
End sub