How to run server side vbscript file from website


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

Who is Participating?
joedelapazAuthor Commented:
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.
HainKurtSr. System AnalystCommented:
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
joedelapazAuthor Commented:
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?

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

HainKurtSr. System AnalystCommented:
try this

System.Diagnostics.Process.Start("cscript c:\Inetpub\wwwroot\DisableDot1x.vbs");
HainKurtSr. System AnalystCommented:
look @ here  :
there are some samples

maybe you should use a new System.Diagnostics.Process instead of using an existing one...
HainKurtSr. System AnalystCommented:
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)?
joedelapazAuthor Commented:
Please award 250 points to HainKurt for his assistance on this issue.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.