How to run server side vbscript file from website

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

In relation to my previous question, about running a batch file from an asp.net 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
  • 4
  • 3
LVL 61

Expert Comment

ID: 26143641
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

ID: 26143980
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 61

Expert Comment

ID: 26144092
try this

System.Diagnostics.Process.Start("cscript c:\Inetpub\wwwroot\DisableDot1x.vbs");
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 61

Expert Comment

ID: 26144104
look @ here  : http://stackoverflow.com/questions/200422/how-to-call-the-vbscript-file-in-c-application
there are some samples

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

Expert Comment

ID: 26144132
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

joedelapaz earned 0 total points
ID: 26309185
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

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


Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
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…
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Stellar Phoenix SQL Database Repair software easily fixes the suspect mode issue of SQL Server database. It is a simple process to bring the database from suspect mode to normal mode. Check out the video and fix the SQL database suspect mode problem.
Suggested Courses
Course of the Month8 days, 13 hours left to enroll

621 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