Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fast-Ping Sweep (recommendations or tricks) #70

Open
CountDClemo opened this issue Apr 28, 2020 · 2 comments
Open

Fast-Ping Sweep (recommendations or tricks) #70

CountDClemo opened this issue Apr 28, 2020 · 2 comments

Comments

@CountDClemo
Copy link

CountDClemo commented Apr 28, 2020

Goal:
I am trying to only use PowerShell to conduct a ping sweep and I want to perform the fastest ping sweep possible.

Research:
I found a quick single line script from “https://learn-powershell.net/2011/01/31/quick-hits-ping-sweep-one-liner/” and leveraged invoke-parallel in place of foreach (%). Also, I added Where-Object {$_ -like "True"} to filter out the false and/or non-pingable IPs.

Request:
So far, I can ping sweep a /24 in about 20 to 25 seconds. I want to know if anyone else has any recommendations or tricks to cut the time down (if possible) only using PowerShell.

Reason:
I am looking into building a branch with a PowerShell based GUI that leverages invoke-parallel to ping sweep subnets and port scan live IPs to validate findings of other commercial and/or opensource networking products.

Script block:

#Very short Script block used with invoke-parallel function
#Requires change of the IP ranges to meet pinged area subnet.
#There are wildcards on each side of the word True. See bottom of the attached Fast-Ping.txt

1..254 |

Invoke-Parallel {

$IPsping = '192.168.3.'

"$IPsping$($): $(Test-Connection -count 1 -comp $IPsping$($) -quiet)" |

Where-Object {$_ -like "True"}}

fast-ping.txt

@Solbstr
Copy link

Solbstr commented Apr 29, 2020

Hi

Try this custom class from Trevor Jones.
https://smsagent.blog/posh-5-custom-classes/power-ping/

Nils

@CountDClemo
Copy link
Author

nilssol,

Thank you,
I can see some parts of the script that I can pull from to target IP ranges vs get-adcomputer. Also, I see the function "Invoke-MultiThreadedCommand" can provide a similar result to invoke-parallel. Very interesting and again think you for the info very helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants