确定计算机的 IP 地址

[ 2005/07/09 09:51 | by gOxiA ]
| |

描述

返回安装在计算机中的每个支持 IP 的网络适配器的 IP 地址。


脚本代码
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set IPConfigSet = objWMIService.ExecQuery _
   ("Select IPAddress from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each IPConfig in IPConfigSet
   If Not IsNull(IPConfig.IPAddress) Then
       For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
           WScript.Echo IPConfig.IPAddress(i)
   Next
   End If
Next

PowerShell & Scripts | 评论(0) | 引用(0) | 阅读(4560)
发表评论
昵称 [注册]
密码 游客无需密码
网址
电邮
打开HTML 打开UBB 打开表情 隐藏 记住我