Hi
I try to create script which read the domains from file and output A and MX recored for this domains, I've already done it for A record.
But unfortunately, I could not find any ideas for MX record.
$ErrorActionPreference = "silentlycontinue" $a = New-Object -comobject Excel.Application $a.visible = $True $b = $a.Workbooks.Add() $c = $b.Worksheets.Item(1) $c.Cells.Item(1,1) = "Server Hostname" $c.Cells.Item(1,2) = "IP Address" $d = $c.UsedRange $d.Interior.ColorIndex = 19 $d.Font.ColorIndex = 11 $d.Font.Bold = $True $intRow = 2 $colComputers = get-content "C:\SCRIPTS\DNS_Lookup\ForwardLookup\test2.txt" foreach ($strComputer in $colComputers) { $FWDIP = [System.Net.Dns]::GetHostAddresses($strComputer) | Add-Member -Name HostName -Value $strComputer -MemberType NoteProperty -PassThru | Select HostName, IPAddressToString $c.Cells.Item($intRow,1) = $FWDIP.Hostname $c.Cells.Item($intRow,2) = $FWDIP.IPAddressToString $intRow = $intRow + 1 } $d.EntireColumn.AutoFit() cls Write-Host "######## This Script is completed now ########"