PRUEBA AHORA
Pro Tips

Subnet Ping Sweep

2 min. read
23/09/2022
By Esben Dochy
ProTips-31

Pro Tips with Esben #31

Similar to last time, we’re using another action. This time we’re going to use an action to ping sweep the subnet of an asset of your choosing and export it to a CSV file.

With a subnet sweep action, you’ll be able to ping all of the IP addresses in a subnet of a specific asset and get an export to a CSV file so you can easily view, filter, and use it for anything else.

subnetsweep csv

Prerequisites & Script

To get the action working, there are a few things that need to be sorted. The first is that you’ll need to download and configure a browser extension so that you can run actions. You can find all the info you need in the custom actions knowledgebase article.

Second, you will need to make sure the path to where the CSV file will be stored exists on your Lansweeper server. The default is C:temp, so make sure that folder exists, or adjust the script and choose a different folder.

For the script, there isn’t anything special you need to do. Simply download the script here and place it in your Lansweeper server’s Actions folder (C:Program Files (x86)LansweeperActions)

Subnet Sweep Custom Action

To create the custom action, head over to ConfigurationAsset Pages and add a new action. In the Action area, add the following command.

powershell -noprofile -ExecutionPolicy bypass -command {actionpath}subnetsweep.ps1 -ip {ipaddress}

Once you execute the action, you’ll see a PowerShell window pop-up which will stay blank for a couple of minutes as the script runs and pings all the IP addresses in the subnet. Once the sweep is completed, the PowerShell windows will automatically close and you’ll find the CSV file in the above-mentioned location.