Created
July 22, 2026 21:56
-
-
Save NQevxvEtg/5d1a6f93b4f80af1eb53bf7aae8d57f4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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