Automation

 View Only
  • 1.  DNS

    Posted Nov 04, 2020 03:34 PM

    Hello,

    Can someone please tell me:

    I have a text file called 'Server_IP' and in that sheet it has all the IPs.

    Is there anyway I can script and get the DNS names by doing nslookup of that IPs and get the result in excel sheet (Can save it in D drvie) like below:

    (Column A)     (Column B)

    Server IP         Server Name



  • 2.  RE: DNS

    Broadcom Employee
    Posted Nov 07, 2020 06:17 AM

    Isn’t your question straight PowerShell rather than PowerCLI? It seems you’re just looking to extract records from your DNS server, whatever that is...



  • 3.  RE: DNS

    Posted Nov 07, 2020 08:55 AM

    You could do something like this

    Get-Content -Path .\file.txt |
    ForEach-Object -Process {
        New-Object -TypeName PSObject -Property @{
            IP = $_
            HostName = (Resolve-DnsName -Name $_).NameHost
        }
    | Export-Csv -Path D:\report.csv -NoTypeInformation -UseCulture