brand new to powershell so i have a steep learning curve.
i need a script that will ping a list of servers from a txt file... it will then save the IP of that server and run a nbtstat -a to make sure dns is correct or not.
maybe theres certain cmdlets that will do this for me?
so far i have come up with the following script which does ping the servers, fails on the ones that arent live any more.. but it doesnt check the dns.
so if the dns is still around for a particular server it will actually come back with a IP reference
Test-Connection -computer (get-content c:\temp2\servers.txt) -count 1| Select Address,IPv4Address
here is what the output looks like so far
so server2 no longer exists but the dns entry is still there... when you do a nbtstat -a on its IP it doesnt find the host.
but a normal ping does find dns entry...
Test-Connection : Testing connection to computer 'server6' failed: Error due to lack of resources
At line:1 char:16
+ Test-Connection <<<< -computer (get-content c:\temp2\servers.txt) -count 1| Select Address,IPv4Address
+ CategoryInfo : ResourceUnavailable: (server:String) [Test-Connection], PingException
+ FullyQualifiedErrorId : TestConnectionException,Microsoft.PowerShell.Commands.TestConnectionCommand
so my query is.. what do i do to save the IP of server2 as a variable and then run another command to do nbstat -a or a command equivalent in powershell...
let me know if you need any more details..