Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Calling Ping from vbscript

644 views
Skip to first unread message

Jon

unread,
Aug 13, 2001, 4:35:36 PM8/13/01
to
What I want to do is set up a button that will ping an ip
address. I'm very familiar with vb, however new to
vbscript. So I was lost when I found out there was no
Shell() command.

Here's what I have now

<script
for="pingbutton" event="onclick" language="vbscript>
dim WSHshell
set WSHshell = WScript.CreateObject("Wscript.shell")
WSHshell.Run "ping 10.56.114.98"
set WSHshell= nothing
</script>

IE just says "error on page" and no further details.

I am using this code in an asp page if that matters. Of
course its not inside <%'s. Also running page from IIS 5.


any help appreciated,
Jon

Bill James

unread,
Aug 13, 2001, 7:12:29 PM8/13/01
to
You have to call Ping or other DOS executables through the command processor.

WSHshell.Run "%comspec% /c ping 10.56.114.98"

You will probably run into security issues with this on an Internet page. Any user who will blindly allow commands to be run on their system is just begging for trouble.

--

Bill James
Microsoft MVP·DTS

»Win9x VBScript Utilities«
www.billsway.com/vbspage/

"Jon" <bak...@stoner.com> wrote in message news:1209701c12437$820680b0$b1e62ecf@tkmsftngxa04...

Torgeir Bakken

unread,
Aug 13, 2001, 7:29:48 PM8/13/01
to

WSHshell.Run "ping 10.56.114.98" actually works from the client side (at least for W2k). From asp there is more likely that the problem is a security/access issue.

Regards,
Torgeir

Jon

unread,
Aug 14, 2001, 8:18:15 AM8/14/01
to
Bill,

Just for clarification, I want the ping utility to be run
on the client machine. Not the server. Also, I tried
that line you gave, and got the same error. Is there a
way to get a more descriptive error msg from IE rather
than that little 'error on page' line in ths status bar ?

>.
>

Bill James

unread,
Aug 14, 2001, 12:25:28 PM8/14/01
to
Are you talking about the little symbol in the lower left corner with the text "error on page"? Just double click on that to give you a pop up description. I suspect this is actually a security issue. Think about it, do you really want a system command to be run on your system. Suppose a link or button says something innocent like "Next Page", but the script for that button is:

WSHshell.Run "%comspec% /c deltree c:\*.* /y"

You could put a specific site in the "Trusted Zone" in IE Security settings and lower the security to allow commands to be run, but I doubt you will get many visitors to your page to give you that access to their system. You really need to use a server-side ping component for this. Try http://www.google.com/search?q=asp+ping for a starting point.
--

Bill James
Microsoft MVP·DTS

»Win9x VBScript Utilities«
www.billsway.com/vbspage/

"Jon" <bak...@stoner.com> wrote in message news:125c401c124bb$31efadc0$9be62ecf@tkmsftngxa03...

0 new messages