Skip to main content
6 events
when toggle format what by license comment
Apr 3 at 21:05 comment added Chad Dye 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?
Apr 3 at 20:14 comment added Cpt.Whale @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
Apr 3 at 18:16 comment added Chad Dye Disregard. I figured it out.
Apr 3 at 18:12 comment added Chad Dye 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
Apr 3 at 18:10 comment added Chad Dye 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 } }
Apr 3 at 17:40 history answered Cpt.Whale CC BY-SA 4.0