user536846
user536846

Reputation: 21

Run a vbscript under an IIS application

I have a vbs file that runs fine and I want to run it under an IIS7 application name. Can this be done? If so, how?

thanks

Upvotes: 2

Views: 6565

Answers (2)

krowe
krowe

Reputation: 2280

Just for fun, I was wondering how to do this. I found an article on the Microsoft support site which told me this was possible at one time. As of IIS 7.5 this is even easier than the article suggests. You simply need to create the mapping in IIS:

Setup dialog for IIS

Steps

  1. Go to the IIS configuration and select the site you'd like to use VBS files with.

  2. Go to the Handler Mappings configuration for that site.

  3. Click Add Script Map... on the right hand side.

  4. Set the Request Path to *.vbs

  5. Set the Executable to "C:\Windows\System32\cscript.exe" //NOLOGO %s %s

  6. Set the Name to something you'll remember if you need to.

  7. Restart IIS (possibly optional but I did this)

Then, test it with a script such as the following:

WScript.Echo "Content-Type: text/html"
WScript.Echo
WScript.Echo "If you see this, it worked."

Save it as test.vbs in your site and go to the URL to see the results. Every script used this way must begin output with the first two lines of this script or IIS will not use it.

Note: I also have the CGI (from the Windows installation disk) and Fast-CGI (from the Windows download center) modules installed. I'm not sure whether either of these are actually needed though.

Upvotes: 0

JB King
JB King

Reputation: 11910

You could look under "Handler Mappings" in IIS and add one similar to ASP which is how I used to run VBScript on the server side years ago. This does imply that the file is on a web server and you are OK with HTML output of the result.

Upvotes: 1

Related Questions