' =============================================================
' function: GetIPAddress
' desc : Returns the IP address of the PC
' params : Void
' returns : IP Address
' =============================================================
Function GetIPAddress()
' get the ip addresses
Set IPConfigSet = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery _
("select IPAddress from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
' for each item in the collection
For Each IPConfig in IPConfigSet
' if the item isn't empty
If Not IsNull(IPConfig.IPAddress) Then
' loop through the addresses
For i = LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
' set the return alue
ipAddr = IPConfig.IPAddress(i)
Next
End If
Next
' destroy the object
Set IPConfigSet = Nothing
' return the ip
GetIPAddress = ipAddr
End Function ' GetIPAddress
Wednesday, 19 October 2011
QTP Script: Get your machines IP address
08:04
No comments
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment