- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Microsoft
- >
- get IP address using VB script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-10-2006 02:35 AM
тАО10-10-2006 02:35 AM
howto get IP address of the WIN2000 workstation using VB script ?
I have this VB script:
Set WshNetwork = WScript.CreateObject("WScript.Network")
WScript.Echo "You Computer Name = " & WshNetwork.ComputerName
to get the Computer Name, but howto add the line to get the IP address ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-10-2006 03:35 AM
тАО10-10-2006 03:35 AM
Solutionipconfig/all|find/I"IP ADDRESS"
and take only the part you require.
The IP address is also hidden away in the registry, but looks like it comes under a sub key which is based on a GUID type string.
You may also get problems with computers with several net adapters.
Sorry can't be more help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-10-2006 04:21 AM
тАО10-10-2006 04:21 AM
Re: get IP address using VB script
'---- get ip addresses and mac address of available NIC's
strComputer = "."
Set SWBemlocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set cItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration",,48)
For Each objItem in cItems
For Each propValue in objItem.IPAddress
MyIP = objItem.IPAddress(0)
MyMac= objItem.MACAddress(0)
strReportLine = strReportLine & " IPMAC:"&MyIP&","&MyMac&","
' objOutputFile.WriteLine(MyIP&","&MyMac&",")
' Console.WriteLine(MyIP&","&MyMac)
' Wscript.WriteLine(MyIP&","&MyMac)
' WScript.Echo "IPAddress: " & MyIP & "MACaddress " &MyMac
Next
Next
objOutputFile.WriteLine(strReportLine)
objOutputFile.Close
Set objFileSystem = Nothing
Jon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-11-2006 03:11 AM
тАО10-11-2006 03:11 AM
Re: get IP address using VB script
Go to my computer and right click on it.
Then go to Manage.
Then go to DNS
Then go to forward lookup zone
Then the systems and IP are listed on the right.
Otherwise my AV program lists them.
You are using DHCP ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-11-2006 05:18 AM
тАО10-11-2006 05:18 AM
Re: get IP address using VB script
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration")
For Each objItem In colItems
For Each objValue In objItem.IPAddress
If objValue <> "" Then
WScript.Echo "Description -- " & objItem.Description & vbcrlf & "IPAddress -- " & objValue & vbcrlf & "MAC: " & objItem.MACAddress
End If
Next
Next
Get your External Public IP...
Call EnumPublicIP()
Sub EnumPublicIP()
const URL = "http://xml.showmyip.com/"
set xmldoc = CreateObject("Microsoft.XMLDOM")
xmldoc.async=false
xmldoc.load(URL)
for each x in xmldoc.documentElement.childNodes
if x.NodeName = "ip" then
myip = x.text
end if
if x.NodeName = "host" then
myhost = x.text
end if
if x.NodeName = "timestamp" then
mytime = x.text
end if
next
myinfo = myip & vbCRLF & myhost & vbCRLF & mytime
wscript.echo "This is your Public Foreward Facing IP Address: " & vbcrlf & myinfo
End Sub
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-11-2006 06:01 AM
тАО10-11-2006 06:01 AM
Re: get IP address using VB script
Use the following array to iterate through all the server variables and their values:
Server Varriable | Value |
<%= name %> | <%= Request.ServerVariables(name) %> |