This PowerShell script is a network scanner. Utilising the Invoke-PingSweep function, it will attempt to ping each host in the specified range and if it gets a response, it will attempt to find open ports from a specified list.
The Invoke-PingSweep function is available from the TechNet gallery and I take no credit for writing this integral part of the script. https://gallery.technet.microsoft.com/scriptcenter/Invoke-TSPingSweep-b71f1b9b
This script will then output a list of discovered IP addresses, hostnames and open ports. There are options to then export to a CSV and/or TXT file as well.
Usage: .\NetScan.ps1 -StartIP 0.0.0.0 -EndIP 18.104.22.168 [-CSV file.csv] [-TXT file.txt] [-CSVHostsOnly] [-TXTHostsOnly]