Wednesday, February 3, 2016

PowerShell Tips : Getting DNS IP from Name using PowerShell.

 

We all love PoweShell. The one of this AWESOME feature it , it's lovely integration with .Net.

If you are looking for a single line of code to convert a hostname to IP. You can use the

[System.Net.DNS]::GetHostByName()

 

Just provide the name in parantheses and get the IP information about the host.

 

[System.Net.DNS]::GetHostByName("www.yahoo.com")

 

 

Try it and see it's magic. ;o) 

5

With Regards.
Aman Dhally
If you like, you can follow me on Twitter and Facebook. You can also check my “You Tube channel for PowerShell video tutorials. You can download all of my scripts from “Microsoft TechNet Gallery”.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.