Is there an easy way in powershell 3.0 Windows 7 to get the local computer\'s ipv4 address into a variable?
Another variant using $env
environment variable to grab hostname:
Test-Connection -ComputerName $env:computername -count 1 | Select-Object IPV4Address
or if you just want the IP address returned without the property header
(Test-Connection -ComputerName $env:computername -count 1).IPV4Address.ipaddressTOstring