How to run server side vbscript file from website

Posted on 2009-12-29
Last Modified: 2012-05-08

In relation to my previous question, about running a batch file from an page.
I now need to run a vbscript file instead of a batch file.
I thought it would have just been a simple task of substituting the batch file name with the vbscript file name.
However, I can run the batch file successfully but not the vbscript file.

I have tried running the vbscript file from within the batch file but this does not work either.

I have tried several other methods as can be seen in this code snippet below.
I've remmed out some of the other options I had tried.

If someone can post up a working code sample, I would be absolutely grateful.

Thanks in advance,
Partial Class TrainingRoom

    Inherits System.Web.UI.Page

    Protected Sub btnDisableDot1x_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDisableDot1x.Click


        ' Define new process

        Dim procDisableDot1x As System.Diagnostics.Process

        ' Start the filename you have specified as this new process

        procDisableDot1x = System.Diagnostics.Process.Start("c:\Inetpub\wwwroot\ScheduleDisableDot1x.cmd")

        'procDisableDot1x = System.Diagnostics.Process.Start("c:\Inetpub\wwwroot\DisableDot1x.vbs")

        ' Wait for the batch file to finish



        ' Define(New process)

        'Dim procOutput As String

        'Dim procDisableDot1x As New System.Diagnostics.Process


        'procDisableDot1x.StartInfo.FileName = "c:\windows\system32\cscript.exe"

        'procDisableDot1x.StartInfo.RedirectStandardOutput = False

        'procDisableDot1x.StartInfo.Arguments = "c:\Inetpub\wwwroot\DisableDot1x.vbs"



        'procOutput = procDisableDot1x.StandardOutput.ReadToEnd




    End Sub

End Class

Open in new window

Question by:joedelapaz
    LVL 51

    Expert Comment

    here it is:

    You can run script files from the command line in one of two ways:

    Type the name of the script, including its file name extension, at the command prompt:


    Type the name of one of the script hosts followed by the name of the script:

    cscript HardwareAudit.vbs
    wscript HardwareAudit.vbs

    Author Comment

    Hi Hain,

    I tried that already, as per

    procDisableDot1x.StartInfo.FileName = "c:\windows\system32\cscript.exe"
    procDisableDot1x.StartInfo.RedirectStandardOutput = False
    procDisableDot1x.StartInfo.Arguments = "c:\Inetpub\wwwroot\DisableDot1x.vbs"

    I've also tried different variations of this programmatically in the script.

    Any other suggestions?

    LVL 51

    Expert Comment

    try this

    System.Diagnostics.Process.Start("cscript c:\Inetpub\wwwroot\DisableDot1x.vbs");
    LVL 51

    Expert Comment

    look @ here  :
    there are some samples

    maybe you should use a new System.Diagnostics.Process instead of using an existing one...
    LVL 51

    Expert Comment

    what happens when you enter DisableDot1x.vbs and hit run on command line?
    is vbs registered? did you install host scripting? does IIS user have access to that file/folder? did you check event manager for any warnings/errors? is that code giving you error? if not, did you check task manager whether it is running or not (since it will be invisible)?

    Accepted Solution

    After a lot more investigation, these were the documents that helped me solve the problem.

    This is the key web page that helped me.

    These pages helped complete the picture and after a little bit of tinkering I finally got it sorted.

    Author Comment

    Please award 250 points to HainKurt for his assistance on this issue.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
    ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
    This video discusses moving either the default database or any database to a new volume.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    737 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

    20 Experts available now in Live!

    Get 1:1 Help Now