Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perl Script does not run inside of VBScript

Status
Not open for further replies.

ralisp

MIS
Apr 19, 2004
21
0
0
US
I'm running a simple script that prompts for a servername, then passes that server into a perl script. It does not bomb, but the perl script is not run. I plan to add error checking later, but for now I'd just like to get this running. The perl scrip runs without issue from the commandline. I noticed that when I changed the oShell.Run to 'true' the return code is 13. Any Ideas?

<%
if Request("SvrMaintModeOn") <> "" then
Dim sProgDir
Dim sHostVar
Dim sExec
Dim sCmd
Dim oShell
Dim stest
Dim rc


sProgDir = "C:\Perl\bin\perl.exe"
sHostVar = " " & Request("ServerName")
sExec = "C:\inetpub\ sCmd = sProgDir & " " & sExec & " " & sHostVar
Set oShell = Server.CreateObject("Wscript.Shell")
rc=oShell.Run(sCmd,1,true)
Response.Write "Maintenance Mode On" & rc
Response.End
end if
%>
<html>
<body>
<p>
<img src=" </p>
<p>
<b>Note:</b> Enter the Server you want to place into Maintenance Mode.
</p>
<form method="post">
Server Name:
<input type="text" name="ServerName">
<br>
<input type="submit" name="SvrMaintModeOn" value="Enter">
</form>
</body>
</html>
 
You have to add IUSR_<computername> user account to the access control (at least, depending on the chain dependency) of perl.exe with the rights to read and execute the executable perl.exe file.
 
Thanks for suggesion, but still unable to execute. Any other ideas?
 
>rc=oShell.Run(sCmd,1,true)
[tt]rc=oShell.Run(sCmd,[red]0[/red],true)[/tt]
Otherwise, no.
 
Code:
sProgDir = "C:\Perl\bin\perl.exe"
sHostVar = [COLOR=red]" " &[/color] Request("ServerName")
sExec =  "C:\inetpub\[URL unfurl="true"]wwwroot\MaintModeSvrEnable.pl"[/URL]
sCmd = sProgDir & " " & sExec & [COLOR=red]" "[/color] & sHostVar
Set oShell = Server.CreateObject("Wscript.Shell")
c=oShell.Run(sCmd,1,true)

not sure if this will fix your problem but you've got two spaces before your parameter.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top