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:
\[-r count\] \[-s count\] <a href="/article/tips/jsi-tip-9436-how-can-i-rapidly-determine-if-a-computer-is-available--83793?topic=-j%20host-list%5c%5d"> \[-k host-list</a>
\[-w timeout\] target_name
-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:
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
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 (
del /q "%TEMP%\%%a"
del /q "%TEMP%\PCOK_*.bat"
@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"