When you attempt to connect to a computer that is shutdown or disconnected, it takes considerable time for your request to time out.
To determine if a computer is responding, you can use the PING (Packet InterNet Groper) command and alter the time out, per:
Usage: ping \[-t\] \[-a\] \[-n count\] \[-l size\] \[-f\] \[-i TTL\] \[-v TOS\] \[-r count\] \[-s count\] \[-k host-list \[-w timeout\] target_name Options: -t Ping the specified host until stopped. To see statistics and continue - type Control-Break; To stop - type Control-C. -a Resolve addresses to hostnames. -n count Number of echo requests to send. -l size Send buffer size. -f Set Don't Fragment flag in packet. -i TTL Time To Live. -v TOS Type Of Service. -r count Record route for count hops. -s count Timestamp for count hops. -j host-list Loose source route along host-list. -k host-list Strict source route along host-list. -w timeout Timeout in milliseconds to wait for each reply.
Example:@ping -n 1 -w 250 <computer name or IP address>
would ping once. If the computer did not respond, the command would terminate within 250 milliseconds.
Using ADFind.exe freeware, I have scripted Demo.bat to rapidly return the NetBIOS computer name and IP address of all the computers in the domain you are logged on to. If the computer is NOT available, the IP address will be NONE. Demo.bat launches one batch file for every computer, using the Start command to run them, without waiting for completion before launching the next one. The output is displayed on the console, like:
"JSI001","188.8.131.52" "JSI009","184.108.40.206" "JSI005","NONE"Demo.bat contains:
@echo off setlocal ENABLEDELAYEDEXPANSION set qry=adfind -default -f "&(objectcategory=computer)" -ps 99999 -nodn -noctl set /a cnt=0 for /f "Tokens=*" %%c in ('%qry%^|Findstr /B /L /C:">name: "') do ( set /a cnt=!cnt! + 1 set wrk="%TEMP%\PCOK_!cnt!.bat" set name=%%c call :PCOKOB "!name:~7!" !cnt!>!wrk! start /min /high CMD /c !wrk! ) @ping -n 7 127.0.0.1>nul for /f "Tokens=*" %%a in ('dir "%TEMP%\PCOK_*.log" /b') do ( type "%TEMP%\%%a" del /q "%TEMP%\%%a" ) del /q "%TEMP%\PCOK_*.bat" endlocal goto :EOF :PCOKOB @echo set IP=NONE @echo for /f "Tokens=3* Delims=: " %%%%i in ('@ping -n 1 -w 250 %1^^^|find "TTL="'^) do set IP=%%%%i @echo @echo %1,"%%IP%%"^>"%TEMP%\PCOK_%2.log" @echo exit