Friday, November 19, 2010

PowerShell script to get the IPv4 address of a server

Possible usage:
Get-HostIp servername | clip

function Get-HostIp([string][parameter(mandatory=$true)]$HostName)
{
 resolve-host $HostName | select -expandproperty addresslist -First 1 | select -ExpandProperty ipaddresstostring
}

0 comments:

Post a Comment