what code does one use to display the tcp/ip settings in a nice window? i wrote a simple script to change tcp/ip setings for my users when they are at home or at work. after the function completes i would like to display the settings in a message box or popup and not goto a command window and run ipconfig from the script

thanks

Re: TCP/IP settings from vbscript by Al

Al
Mon May 24 22:02:13 CDT 2004


"Bill" <anonymous@discussions.microsoft.com> wrote in message
news:D12C2A74-ACA5-4D85-AEEC-9302607F07BF@microsoft.com...
> what code does one use to display the tcp/ip settings in a nice window? i
wrote a simple script to change tcp/ip setings for my users when they are at
home or at work. after the function completes i would like to display the
settings in a message box or popup and not goto a command window and run
ipconfig from the script.
>
> thanks

' adjust tcp/ip settings
<insert your code here>
msg = "IP address is: " & IPadr _
& vbnewline & "Gateway is: " &Gway
msgbox msg

That ought to do it for you - of course, you will have to adjust the
expression being assigned to the msg variable to supply the info you want to
show the user.

Another way could be to run ipconfig in stealth mode, piping the output into
a file, then opening it, reading it, and displaying that in a msgbox.

/Al



Re: TCP/IP settings from vbscript by anonymous

anonymous
Tue May 25 01:16:03 CDT 2004

thanks al. however, what i need is a function on how to get the tcp/ip configs. i'm wanting to do this without having to redirect to a text file then opening that file up for reading then deleting it. i could read the reg at "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\6\ServiceName" but i was hoping there was already a builtin function for this...seems the value between '"NetworkCards\??\ServiceName" is different on different versions of windows.

Re: TCP/IP settings from vbscript by BrianEdwardo

BrianEdwardo
Tue May 25 12:33:07 CDT 2004

Look up the scriptomatic tool from Microsoft, it is an hta file that list
and gives example for all WMI properties.
Very nice reference tool when you are in need of something like this.


--
BRIAN EDWARDO
"Bill" <anonymous@discussions.microsoft.com> wrote in message
news:135C2E60-035E-4477-A7EA-F5354BC56CBF@microsoft.com...
> looks like i can use wmi's Win32_NetworkAdapterConfiguration to pull this
information. i'll work with that for a while.
>
> thanks



Re: TCP/IP settings from vbscript by anonymous

anonymous
Tue May 25 19:11:04 CDT 2004

Thanks, will that handy tool

Re: TCP/IP settings from vbscript by Peter

Peter
Thu May 27 13:47:59 CDT 2004

I've got this handy tools from somewhere on the net.
This may help you to get the head start

Peter Nguyen
' Returning IP Configuration Data
' WMI script that returns configuration data similar to that returned by
IpConfig.

strComputer = "."
WScript.Echo strComputer

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colAdapters = objWMIService.ExecQuery _
("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")

n = 1
WScript.Echo

For Each objAdapter in colAdapters

WScript.Echo "Network Adapter " & n
WScript.Echo "================="
WScript.Echo " Description: " & objAdapter.Description
WScript.Echo " Physical (MAC) address: " & objAdapter.MACAddress
WScript.Echo " Host name: " & objAdapter.DNSHostName

If Not IsNull(objAdapter.IPAddress) Then
For i = 0 To UBound(objAdapter.IPAddress)
WScript.Echo " IP address: " & objAdapter.IPAddress(i)
Next
End If

If Not IsNull(objAdapter.IPSubnet) Then
For i = 0 To UBound(objAdapter.IPSubnet)
WScript.Echo " Subnet: " & objAdapter.IPSubnet(i)
Next
End If

If Not IsNull(objAdapter.DefaultIPGateway) Then
For i = 0 To UBound(objAdapter.DefaultIPGateway)
WScript.Echo " Default gateway: " &
objAdapter.DefaultIPGateway(i)
Next
End If

WScript.Echo
WScript.Echo " DNS"
WScript.Echo " ---"
WScript.Echo " DNS servers in search order:"

If Not IsNull(objAdapter.DNSServerSearchOrder) Then
For i = 0 To UBound(objAdapter.DNSServerSearchOrder)
WScript.Echo " " & objAdapter.DNSServerSearchOrder(i)
Next
End If

WScript.Echo " DNS domain: " & objAdapter.DNSDomain

If Not IsNull(objAdapter.DNSDomainSuffixSearchOrder) Then
For i = 0 To UBound(objAdapter.DNSDomainSuffixSearchOrder)
WScript.Echo " DNS suffix search list: " &
objAdapter.DNSDomainSuffixSearchOrder(i)
Next
End If

WScript.Echo
WScript.Echo " DHCP"
WScript.Echo " ----"
WScript.Echo " DHCP enabled: " & objAdapter.DHCPEnabled
WScript.Echo " DHCP server: " & objAdapter.DHCPServer

If Not IsNull(objAdapter.DHCPLeaseObtained) Then
utcLeaseObtained = objAdapter.DHCPLeaseObtained
strLeaseObtained = WMIDateStringToDate(utcLeaseObtained)
Else
strLeaseObtained = ""
End If
WScript.Echo " DHCP lease obtained: " & strLeaseObtained

If Not IsNull(objAdapter.DHCPLeaseExpires) Then
utcLeaseExpires = objAdapter.DHCPLeaseExpires
strLeaseExpires = WMIDateStringToDate(utcLeaseExpires)
Else
strLeaseExpires = ""
End If
WScript.Echo " DHCP lease expires: " & strLeaseExpires

WScript.Echo
WScript.Echo " WINS"
WScript.Echo " ----"
WScript.Echo " Primary WINS server: " & objAdapter.WINSPrimaryServer
WScript.Echo " Secondary WINS server: " &
objAdapter.WINSSecondaryServer
WScript.Echo

n = n + 1

Next

Function WMIDateStringToDate(utcDate)
WMIDateStringToDate = CDate(Mid(utcDate, 5, 2) & "/" & _
Mid(utcDate, 7, 2) & "/" & _
Left(utcDate, 4) & " " & _
Mid (utcDate, 9, 2) & ":" & _
Mid(utcDate, 11, 2) & ":" & _
Mid(utcDate, 13, 2))
End Function

"Bill" <anonymous@discussions.microsoft.com> wrote in message
news:49743331-6622-4CF6-86DC-02DDC6319EB4@microsoft.com...
> Thanks, will that handy tool



Re: TCP/IP settings from vbscript by anonymous

anonymous
Thu May 27 19:11:02 CDT 2004

Thanks Peter. I found one too and already wrote my script but the date func you included is something i'll keep in the toolbox. thanks again