2012. 8. 10. 14:01
vbs IPv4 IP 주소 쿼리 Etc.2012. 8. 10. 14:01
VB 스크립트를 이용한 IPv4 IP 주소 쿼리
VBS VBScript IP Address
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
VBS VBScript IP Address
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colItems = objWMIService.ExecQuery ("SELECT IPAddress FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'True'")
sIPAddr = ""
For Each Item in colItems
If Not IsNull(Item.IPAddress) Then
For i = LBound(Item.IPAddress) to UBound(Item.IPAddress)
If Not Instr(Item.IPAddress(i), ":") > 0 Then
sIPAddr = sIPAddr & Item.IPAddress(i) & ","
End If
Next
End If
Next
Set colItems = Nothing
WScript.Echo Left(sIPAddr,Len(sIPAddr)-1)