开发者

Finding IP Address of my computer using VBScript

开发者 https://www.devze.com 2023-01-01 03:31 出处:网络
How can I find the IP Address of my co开发者_StackOverflowmputer using VBScript?This example shows the ip configured and the computer name:

How can I find the IP Address of my co开发者_StackOverflowmputer using VBScript?


This example shows the ip configured and the computer name:

dim NIC1, Nic, StrIP, CompName

Set NIC1 =     GetObject("winmgmts:").InstancesOf("Win32_NetworkAdapterConfiguration")

For Each Nic in NIC1

    if Nic.IPEnabled then
        StrIP = Nic.IPAddress(0)

        Set WshNetwork = WScript.CreateObject("WScript.Network")
        CompName= WshNetwork.Computername

        MsgBox "IP Address:  "&StrIP & vbNewLine _
            & "Computer Name:  "&CompName,4160,"IP Address and Computer Name"

        wscript.quit
    End if
Next
0

精彩评论

暂无评论...
验证码 换一张
取 消