I get asked this question so many times, that I decided to script a solution.
The Domain_Computer.bat script is designed to be run multiple times, during a time period that most computers would likely be powered on. It pings every computer in the "Domain Computers" group and tracks their response. It creates a Domain_Computers folder on your workstation, on the same partition as Domain_Computer.bat, and creates a file for every computer, where the file name is the computer name and the extension is the number of times that the computer responded. 'Dead' computers have a .0000 extension. If you run this script 8 times in a month, most 'live' computers will have an extension of .0008. The file creation date will tell you the last time that a computer responded. You can periodically delete all the files and start over.
@echo off setlocal set drive=%~d0 %drive% if not exist %drive%\Domain_Computers MD Domain_Computers pushd %drive%\Domain_Computers for /f "Skip=8 Tokens=*" %%w in ('net Group "Domain Computers" /domain') do set line=%%w&call :parse endlocal goto :EOF :parse set workstn=%line:~0,25%# If /i "%workstn%" EQU "The command completed suc#" goto :EOF call :parse1 set workstn=%line:~25,25%# if not "%workstn%" EQU "#" call :parse1 set workstn=%line:~50,25%# if not "%workstn%" EQU "#" call :parse1 goto :EOF :parse1 set workstn=%workstn: =% set workstn=%workstn: #=% set workstn=%workstn:#=% set workstn=%workstn:$=% set OK=Y for /f "Tokens=1" %%a in ('ping -n 1 %workstn%') do set response=%%a&call :isok if /i "%OK%" EQU "Y" goto postok if /i "%OK%" EQU "N" goto postno :postunk if exist %workstn%.* del /q %workstn%.* @echo.>%workstn%.0000 goto :EOF :postno if exist %workstn%.* goto :EOF @echo.>%workstn%.0000 goto :EOF :postok if not exist %workstn%.* @echo.>%workstn%.0000 for /f "Tokens=2 Delims=." %%b in ('dir /b %workstn%.*') do set times=%%b set /a times=1%times% + 1 set times=%times:~1,4% del /q %workstn%.* @echo.>%workstn%.%times% goto :EOF :isok If /i "%response%" EQU "Request" set OK=N&goto :EOF If /i "%response%" EQU "Unknown" set OK=U&goto :EOF