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

IP Address release and renew

Status
Not open for further replies.

kpierick

ISP
Jul 31, 2002
22
US
Does anyone know how to make the following happen:

Web Page with a button - once the user clicks on the button it needs to run a vbscript that does an IPCONFIG /release and /renew command on the "users machine" NOT on the web server.

I tried using WScript -
shell.run ("%comspec% /c ipconfig /release")

but this actually does a release on the web servers IP address rather than the persons machine who actually clicked on the submit button.

Thanks in advance...
kpierick
 
kpierick,

<html>
<head>
<script language=&quot;VBScript&quot;>
function userexec()
set wsh = createobject(&quot;wscript.shell&quot;)
wsh.run (&quot;%comspec% /c ipconfig /release&quot;)
end function
</script>
</head>
<body>
<form name=&quot;myform&quot;>
<input type=&quot;button&quot; value=&quot;Release&quot; onClick=&quot;userexec()&quot;>
</form>
</body>
</html>


fengshui_1998
 
kpierick,

I forgot to tell you. The code will only run in IE browser, if that's okay.


fengshui_1998
 
I've tried this and the code runs, except it does the release for the ip address of the &quot;actual web server&quot; rather than the end-users machine...????

Is there a way that it works with Netscape and Mac systems???

thanks,
kpierick
 
kpierick,

This code should execute on the client side if you are viewing it with a browser to a web server. Since the page is loaded on the client side, when the user clicks the button, the command is executed on the client. It does not send the command to the server.

For it to work with Netscape, you would have to code in Javascript. For it to work on a MAC, does MacINtosh support &quot;netsh&quot; command?

fengshui_1998
 
ok - I copied your code above and put it in an html page...that sits on my web server. The only change I made, was to output the results to a text file:
wsh.run &quot;%comspec% /c ipconfig /release > c:\release.txt&quot;,1,true

I click on the button in the &quot;form&quot; and when I do it acts as though it processes it, but I don't get a &quot;release.txt&quot; file on either the c:\ of the computer I run the program from or on the web server where the code resides?????

any ideas?

 
kpierick,

I don't believe WSH knows about &quot;%comspec%&quot; unless you translate environment variables. So therefore it doesn't know what shell you are running, COMMAND or CMD. If you are on W2K, just put in &quot;CMD&quot;.

comspec = WshShell.ExpandEnvironmentStrings(&quot;%COMSPEC%&quot;)

fengshui_1998
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top