Reputation: 21
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
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:
Steps
Go to the IIS configuration and select the site you'd like to use VBS files with.
Go to the Handler Mappings
configuration for that site.
Click Add Script Map...
on the right hand side.
Set the Request Path
to *.vbs
Set the Executable
to "C:\Windows\System32\cscript.exe" //NOLOGO %s %s
Set the Name
to something you'll remember if you need to.
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
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