I'm trying to automate IIS 5.1 AdminScripts from my local VB program.

Posted on 2006-03-20
Last Modified: 2010-04-07
What I did try but not success:
Dim x&
x = ShellExecute(Me.hwnd, "open", App.Path & "\stopweb.vbs -a //", 0, 0, vbNormal) is my computers IP and it's name is Palvelin.

Does anyone have better parameters on this command line?

Question by:Matti
    LVL 70

    Accepted Solution


    You're not passing the right parameters into the Stop Script. What exactly are you trying to achieve?

    If it's the Default Website you want to stop then the syntax is:

    StopWeb.vbs -c palvelin -a 1

    (Palvelin can be the IP Address, just don't include the //).

    For note...

    StopWeb.vbs has an optional Argument of "-c <Computer>", and a mandatory Argument of "-a <SiteID>" which is the ID of the Site you actually want to stop.

    If you want to Stop all the sites on the Server then it is possible to loop through all the Website instances under the W3SVC Node in the Metabase but this isn't something StopWeb achieves.

    LVL 14

    Author Comment


    This worked, thanks for the syntax
    x = ShellExecute(Me.hwnd, "open", App.Path + "\StopWeb.vbs", "-c matti -a 1", 0, vbNormal)

    I have a VB IIS application which has some problems but when site is restarted the app goes up again. So I needed to scheduled stop/restart automated just for a moment .


    LVL 70

    Expert Comment

    by:Chris Dent

    Glad I could help :)


    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
    When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now