search
Categories
Sponsors
VirtualMetric Hyper-V Monitoring, Hyper-V Reporting
Archive
Blogroll

Badges
MCSE
Community

Cozumpark Bilisim Portali
Posted in Windows Powershell | No Comment | 2,047 views | 21/06/2013 15:54

You can resolve ip addresses of many servers via Powershell.

1
2
3
4
5
6
7
8
9
10
11
12
$Servers = Get-Content C:\Servers.txt
foreach ($Server in $Servers)
{
	$IPAddress = $null
	$IPAddress = [System.Net.Dns]::GetHostAddresses("$Server").IPAddressToString
	Add-Content -Path C:\ServerName.txt -Value $Server
	if ($IPAddress -eq $null)
	{
		$IPAddress = "Server IP cannot resolve."
	}
	Add-Content -Path C:\ServerIP.txt -Value $IPAddress
}

It creates two different txt file, so you can merge them in an excel file.