Solved

Powershell script to perform nslookup on multiple servers

Posted on 2016-10-06
3
21 Views
Last Modified: 2016-10-29
I would like to perform nslookup on multiple servers using powershell script.

I would also like to get the same for ping
0
Comment
Question by:Kailash Kapal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 70

Expert Comment

by:Qlemo
ID: 41836163
Is this correct? You want to provide a list of server names, perform a DNS query for those (why?), then ping, and log the results?
0
 

Author Comment

by:Kailash Kapal
ID: 41842365
You are correct. Only thing is I want to perform an nslookup and ping separately for a list of servers in a text file and pipe the output to a csv file. This is required so that I can fulfill any business requirements.
0
 
LVL 70

Accepted Solution

by:
Qlemo earned 500 total points
ID: 41842443
Are we on W2012 R2/W8.1 or later? Those allow for new cmdlets making things easy:
Get-Content C:\Temp\EE\Servers.txt |
  % {
    Resolve-DnsName $_ -EA SilentlyContinue 
    if (!$?) { [PsCustomObject] @{ Name = $_; IP4Address = '' } }
  } |
  Select Name, IP4Address |
  Export-Csv -NoType C:\Temp\EE\DNSLookups.csv

Open in new window

0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In its Critical Driver Installation Order document, Intel stresses that this sequence be followed:   1       Fresh Operating System Installation 2       Latest Service Pack or Patch 3       Intel® Chipset Software Installation Utility (INF Utili…
1. Start | Settings | Printers and Faxes. 2. Go to the File Menu. 3. Select Server Properties. 4. Select the Drivers tab. 5. Select the printer you need information about. 6. Once again select Properties. You should get a list of the files requ…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…
Suggested Courses

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question