Batch file to ping a range of IP addresses

Batch Script to Ping a Range of IP Addresses to Identify Active Computers

set startTime=%time%
ECHO Starting the IP Scan
FOR /L %%i IN (1,1,2) DO @(
ECHO Pinging IP Range: 192.168.%%i._
FOR /L %%z IN (1,1,10) DO @(
echo Pinging IP: 192.168.%%i.%%z
ping -n 1 -w 500 192.168.%%i.%%z | FIND /i “Reply”>>IPScanResults.txt
ECHO Run Time = %startTime% to %time%>>IPScanResults.txt
ECHO *** IP Scan Complete. ***
ECHO Check the file called IPScanResults.txt to see the results
ECHO Run Time = %startTime% to %time%

PowerShell Script to poll a list of computers to find any with open admin$ shares






$ComputerFile = New-Item -type file -force “c:\scripts\Success_Computers.txt”

$FailedComputerFile = New-Item -type file -force “c:\scripts\Failed_Computers.txt”

#write-host -fore Blue “`t———————————————”

for ( ; ; ) {

Import-CSV c:\scripts\computers.txt | % {

$Computer = $_.ComputerName

$adminpath = Test-Path \\$Computer\admin$

If ($adminpath -eq “TRUE”){

write-host -fore Green “`tAdmin$ Success`t`t” $Computer “`t”

Add-Content $ComputerFile $Computer



# write-host -fore Red “`tAdmin$ Failed`t`t” $Computer “`t”

# Add-Content $FailedComputerFile $Computer}

# write-host -fore Blue “`t———————————————“


Start-Sleep -s 300