Skip to content

Instantly share code, notes, and snippets.

@NQevxvEtg
Created July 22, 2026 21:56
Show Gist options
  • Select an option

  • Save NQevxvEtg/5d1a6f93b4f80af1eb53bf7aae8d57f4 to your computer and use it in GitHub Desktop.

Select an option

Save NQevxvEtg/5d1a6f93b4f80af1eb53bf7aae8d57f4 to your computer and use it in GitHub Desktop.
param(
[Parameter(Mandatory=$true)]
[string]$File
)
if (-not (Test-Path $File)) {
Write-Host "File not found: $File"
exit 1
}
Get-Content $File | ForEach-Object {
$name = $_.Trim()
if (-not $name -or $name.StartsWith('#')) { return }
try {
$result = Resolve-DnsName -Name $name -Type A -ErrorAction Stop
$ips = $result | ForEach-Object { $_.IPAddress }
Write-Host "$name -> $($ips -join ', ')"
}
catch {
Write-Host "$name -> [no record]"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment