Posts

Showing posts from October, 2024

Scan your network with PowerShell

Image
 I recently came across this cool script on LinkedIn that let you scan your network for devices with open ports. This is normally something that requires 3. party tool software that you might not be keen to install in your server. With this tool you can scan your network with a PowerShell script. How to run this Script Copy the script below to PowerShell ISE or save it as a script. Change the $localIP variable to your own IP address and your are ready to go. Clear # if you dont specify IP Address here, the script will get automatically address from network card with DHCP attribute $localIP = '192.168.1.10' # Obtain the IP address of the local machine if($localIP -eq '') {      $localIP = (Get-NetIPAddress | Where-Object { $_.AddressFamily -eq 'IPv4' -and $_.PrefixOrigin -eq 'Dhcp' }).IPAddress } # List of common ports to be scanned $portsToScan = @(20,21,22,23,25,53,80,110,123,143,161,443,445,993,995,3306,3389,5900,8080) # Extract the first three bytes

Popular posts from this blog

Use PowerShell to Discover Network Switch and port number

How to get Public IP Using PowerShell

Use ChatGPT to write PowerShell Scripts