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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Launching a .vbs file from asp page

Status
Not open for further replies.

EdRev

Programmer
Aug 29, 2000
510
US
I have this asp code that will launch an external vbscript.

<a href=&quot;c:\somevbs.vbs&quot;><input type=image src=&quot;blocal.gif&quot; onclick=&quot;return false&quot;></a>&nbsp;&nbsp;&nbsp;&nbsp;
</td>

Is this the correct way of doing it or do I need to create a function inside my asp code to launch the script and if so how do I code this function.

Any help will be greatly appreciated.
 
Are you trying to run the vbs file on the server or the client?

Thanks,

Gabe
 
EdRev,

I have a function that allows you to run a script on any server as long as you have access to that server.

fengshui_1998

'****************************************
Function Remote_Cmd(Server, accnt, pwd, strCmd)
'****************************************
On Error Resume Next
Set Locator = CreateObject(&quot;WbemScripting.SWbemLocator&quot;)
user = server & &quot;\&quot; & accnt

Set Service = Locator.ConnectServer(Server, &quot;root\cimv2&quot;, user, pwd)
Service.Security_.impersonationlevel = 3
Set Process = Service.Get(&quot;Win32_Process&quot;)
intStatus = Process.Create(&quot;cmd /C &quot; & strCmd, null, null, intProcessId)
' response.write err.number & &quot; &quot; & err.description
If err.number <> 0 then
Remote_Cmd = err.number
Else
Remote_Cmd = 0
End If
End Function
 
Thanks guys!

GabeC - The vbs file is in the server and I will run it on the server too.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top