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

how to create ipconfig vbscript

Status
Not open for further replies.
Mar 1, 2003
853
US
We support many users at different locations. When I do the troubleshooting, I use a lot of ipconfig /all command. I wonder if it is possible create ipconfig vbscript and add it into our Intranet so that the users can get their ipconfig information by just one click? If yes, can you give me the details how to make it or where can I download the sample?

Thanks.

Robert Lin, MS-MVP, MCSE & CNE
Windows, Network and How to at
 
In your intranet create the following ipconfig.vbs file:
Code:
Set oSh=CreateObject("WScript.Shell")
Set oEx=oSh.Exec("ipconfig /all")
Do While oEx.Status=0
  WScript.Sleep 100
Loop
buf=Replace(oEx.StdOut.ReadAll,vbCrLf,"")
WScript.Echo buf
WScript.Quit
In your asp or html page add a link similar to this:
Code:
<A href=ipconfig.vbs>Your IP config</A>

Hope This Help
PH.
 
Hi PHV,

Thank you for the help. It works. But, I already have a similar one (batch file under your ip is) on my web. The problem is that the user will have three options when clicking on it, and he must click Open to run it. Can I run this vbs on the server site instead of on the client site? If yes, how?

Robert Lin, MS-MVP, MCSE & CNE
Windows, Network and How to at
 
You can try something like this:
Code:
In the head part of your asp or html page insert this:[code]
<SCRIPT Language=VBScript>
Sub GetIpconfig()
Set oSh=CreateObject(&quot;WScript.Shell&quot;)
Set oEx=oSh.Exec(&quot;ipconfig /all&quot;)
Do While oEx.Status=0
Loop
buf=Replace(oEx.StdOut.ReadAll,vbCrLf,&quot;&quot;)
MsgBox buf
End Sub</SCRIPT>
and then create a button or a link to call the GetIpconfig sub.

Hope This Help
PH.
 
I tested it by clicking a link to the below code. it seems to run but no thing shows up (under bottom shows Done&quot;and no error. Do I miss some thngs?

<html>

<head>
<SCRIPT Language=VBScript>
Sub GetIpconfig()
Set oSh=CreateObject(&quot;WScript.Shell&quot;)
Set oEx=oSh.Exec(&quot;ipconfig /all&quot;)
Do While oEx.Status=0
Loop
buf=Replace(oEx.StdOut.ReadAll,vbCrLf,&quot;&quot;)
MsgBox buf
End Sub</SCRIPT>

<title>test ipconfig</title>
</head>

<body>
</body>

</html>


Robert Lin, MS-MVP, MCSE & CNE
Windows, Network and How to at
 
You can simply replace your BODY tag with this:
Code:
<BODY OnLoad=GetIpconfig()>

Hope This Help
PH.
 
PH,

I find the problem. It did get an error. When running it, under bottom, it shows error on page. Then it becomes &quot;Done&quot;. After I lowered the cesurity, it works with warming &quot;A ActiveX control on this page might be unsafe to interact with other parts of the page&quot;.

Some one told me that way we are doing is running on the client site, and we should do it on the web server site. It may need to create activeX control using VB. but I don't have VB and don't know how to do it.

Thank you very much.

Robert Lin, MS-MVP, MCSE & CNE
Windows, Network and How to at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top