Wednesday, 19 October 2011

QTP Script: Get your machines IP address


' =============================================================
' 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.IPAddressThen

        ' loop through the addresses
        For i = LBound(IPConfig.IPAddressto 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


14 comments:

  1. This returns IPv6. How do I get the IPv4 address?

    ReplyDelete
  2. Hello mates, its wonderful article regarding cultureand completely
    defined, keep it up all the time.

    Also visit my web site: minecraft

    ReplyDelete
  3. I am really loving the theme/design of your weblog.

    Do you ever run into any web browser compatibility issues?
    A handful of my blog visitors have complained about my website not operating correctly in Explorer but looks great in Opera.

    Do you have any advice to help fix this problem?

    Have a look at my blog ... Nutrition Bars

    ReplyDelete
  4. With havin so much content do you ever run into any problems of plagorism or copyright infringement?
    My blog has a lot of unique content I've either authored myself or outsourced
    but it looks like a lot of it is popping it up all over the
    web without my permission. Do you know any ways to help protect
    against content from being stolen? I'd certainly appreciate it.


    Here is my homepage Quest Bars Free Sample

    ReplyDelete
  5. Unquestionably believe that which you stated.
    Your favorite reason appeared to be on the internet the simplest thing to
    be aware of. I say to you, I certainly get annoyed while people consider worries
    that they just don't know about. You managed to hit the nail
    upon the top as well as defined out the whole thing without having side-effects ,
    people could take a signal. Will likely be back to get more.
    Thanks

    Here is my homepage: from quest protein bars

    ReplyDelete
  6. Hi, I do think this is an excellent blog. I stumbledupon it ;) I may revisit
    once again since I book-marked it. Money and freedom is the best way to
    change, may you be rich and continue to guide
    others.

    Visit my homepage: quest nutrition bars

    ReplyDelete
  7. I was able to find good information from your articles.


    Feel free to surf to my web-site; quest bars

    ReplyDelete
  8. What's Taking place i'm new to this, I stumbled upon this I
    have found It positively helpful and it has aided me out loads.
    I am hoping to give a contribution & assist different customers like its helped
    me. Great job. Quest Bars blogesaurus

    Here is my page ... quest nutrition quest bars

    ReplyDelete
  9. I read this piece of writing fully regarding the difference of most recent and previous technologies, it's amazing article.



    Here is my page :: facebook quest protein bar

    ReplyDelete
  10. Link exchange is nothing else however it is only placing the other
    person's web site link on your page at suitable place
    and other person will also do same for you.



    my blog post; Lose Weight for Women

    ReplyDelete
  11. Thank you for any other magnificent article. The place else
    may anyone get that type of info in such an ideal way of writing?
    I have a presentation next week, and I am at the search for such information.

    Here is my page Diet Plans for Women to Lose Weight

    ReplyDelete
  12. Howdy! Quick question that's entirely off topic. Do you know how to make your site mobile friendly?
    My site looks weird when browsing from my
    apple iphone. I'm trying to find a theme or plugin that might be able to resolve this problem.
    If you have any suggestions, please share. Appreciate it!


    Feel free to surf to my web page :: coconut oil hair

    ReplyDelete
  13. This comment has been removed by the author.

    ReplyDelete
  14. Nice blog useful for those who are looking for some script to find the ip address of a pc ..I am not tech savvy so i usually find my system ip address through ipconfig command ..Then i will visit sites like Ip-Details.com to find my present network ip address ...

    ReplyDelete