Results 1 to 4 of 4

Thread: how do i control IIS server from my VB code?

  1. #1

    Thread Starter
    Junior Member eeeks's Avatar
    Join Date
    Oct 2001
    Location
    CA
    Posts
    17

    Question how do i control IIS server from my VB code?

    Hey, a very simple query...does anyone know what objects/library to use to manipulate IIS server from my code.
    I want to get the web site down for some db maintenance and when the job finishes have to bring the site back up again.

    Anxious,
    eeeks

  2. #2
    New Member
    Join Date
    Aug 2001
    Posts
    5
    Below code is for how to stop web site and start web site.
    Contact me if you need to know how to "unload application" or "shut down package for NT" or "shut down COM+ application for W2K". Or you can find these infomatin in MSDN, under ADSI topic.

    Zoe


    Set oIIsObj = GetMetabaseWebSiteObject("localhost", "mywebsit")

    ' stop it
    oIIsObj.Stop

    ' start it
    oIIsObj.Start


    '****************************************
    'serverName can be your machine name or "localhost"
    'webSiteName is your website name

    Function GetMetabaseWebSiteObject(serverName as String, webSiteName as String) as Object

    dim objMetabases, objMetabase
    Set objMetabases=GetObject("IIS://" & serverName "/W3SVC")

    For Each objMetabase In objMetabases
    If objMetabase.KeyType = "IIsWebServer" Then
    If objMetabase.servercomment = webSiteName Then
    Set GetMetabaseWebSiteObject= GetObject(objMetabase.ADsPath)
    Set objMetabases= Nothing
    Exit function
    End If
    End If
    Next

  3. #3

    Thread Starter
    Junior Member eeeks's Avatar
    Join Date
    Oct 2001
    Location
    CA
    Posts
    17

    Thanx!

    hey that was quick! thanx for the reply.
    eeeks

  4. #4
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    http://msdn.microsoft.com/library/de...p/abgu26y6.asp

    should have more info than you want to know.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width