Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • So, as above I would prefer to use the Ping command for this, but I am seeing that there is a major roadblock I am going to have to get over. Here is the modified version of your code that I tried to use: { # Define a list of IP addresses and hostnames to ping $targets = @("8.8.8.8","9.9.9.9") # Loop through each target and ping it # I use -AsJob to force failed pings to get included in results while (1) { $job = ping $target -n 1 -AsJob $results = $job | Wait-Job | Receive-Job $results | Export-CSV c:\Users\Chad\Desktop\Results.csv } }
    – Chad Dye
    Commented Apr 3 at 18:10
  • The error I am getting is this: Wait-Job : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input. At line:8 char:23 + $results = $job | Wait-Job | Receive-Job + ~~~~~~~~ + CategoryInfo : InvalidArgument: ( [-r...[-k host-list]]:PSObject) [Wait-Job], ParameterBindingException
    – Chad Dye
    Commented Apr 3 at 18:12
  • Disregard. I figured it out.
    – Chad Dye
    Commented Apr 3 at 18:16
  • @ChadDye Unfortunately, Ping only outputs text, which needs to be manually split into columns (and account for error messages and such). You can use Test-Connection -Quiet instead of -AsJob to make it quite a bit faster, but it only outputs true/false for each target, so it's a bit harder to export
    – Cpt.Whale
    Commented Apr 3 at 20:14
  • I guess I will have to look into how to manually format CSVs. I've already done quite a bit of trial and error in that department myself. Do you have any resources on hand that you would recommend for this?
    – Chad Dye
    Commented Apr 3 at 21:05