Getting Local IP address running a VBS script locally 
Author Message
 Getting Local IP address running a VBS script locally

I am very new to VBS and I was wondering if I try running a .vbs script on
my machine(Win98) how could I
make it have a dialog box with my current IP address.

Thanks,
JJJ



Fri, 04 Jul 2003 04:47:11 GMT  
 Getting Local IP address running a VBS script locally
Try this function that will eventually return your IP
(Ripped from msdn.microsoft.com sorry I cant remember the URL)

It may be corrupt as I didnt check it enough... =)

On Error Resume Next
WScript.Echo getcurip()
function getcurip()
sNic = regout("HKLM\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\NetworkCards\1\ServiceName")
'sMan = regout("HKLM\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\NetworkCards\1\Manufacturer")
sTcpipRegKey = "HKLM\SYSTEM\CurrentControlSet\Services\" & sNic &
"\Parameters\Tcpip\"
    bIsDHCP = regout(sTcpipRegKey & "EnableDHCP")
    If bIsDHCP Then
 wscript.echo "DHCP-IP: " & regout(sTcpipRegKey & "DhcpIPAddress")
 wscript.echo "IP: " & regout(sTcpipRegKey & "IPAddress")
        getcurip = regout(sTcpipRegKey & "DhcpIPAddress")
wscript.echo "Error: "& Err.Number & Err.Description
Else
 wscript.echo "IP: " & regout(sTcpipRegKey & "IPAddress")
        getcurip = regout(sTcpipRegKey & "IPAddress")
wscript.echo "Error: "& Err.Number & Err.Description
End If
end Function

function regout(value)
Set regrespons = CreateObject("WScript.Shell")
regout=regrespons.RegRead(value)
end function

Quote:

> I am very new to VBS and I was wondering if I try running a .vbs script on
> my machine(Win98) how could I
> make it have a dialog box with my current IP address.

> Thanks,
> JJJ



Fri, 04 Jul 2003 08:27:01 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Getting Local IP Address of Machine

2. Getting IP Address of Local Machine

3. Getting Local IP Address of Machine

4. Getting Local machine IP address

5. Getting Local IP Address

6. Running a .vbs script from within a .vbs script

7. Local IP Address

8. Local IP Address

9. Local IP address

10. vbscript to change local ip address

11. Getting the ip address based on the MAC Address

12. Getting a machine's MAC address given a NETBIOS machine name or IP address

 

 
Powered by phpBB® Forum Software