@Echo off Title Collect MAC Addresses color 0a Setlocal EnableDelayedExpansion :: EXTERNAL VARIABLES rem Server file(s) path set Server=C:\Temp\MAC rem Report name Set report=Report.txt rem Enter name of computer text file Set PCList=computers.txt :: INTERNAL VARIABLES - do not edit below this line rem ---------------------------------------------------------------------------- :: CREATES DATE AND TIME TIMESTAMP for /F "tokens=2-4 delims=/- " %%p in ('date/T') do set mdate=%%r%%p%%q for /F "tokens=1-2 delims=:- " %%p in ('time/T') do set mtime=%%p%%q Set ReportN=%mdate%_%mtime%_%report% cls :: PROGRAM ROUTINE :CYCLE for /f "tokens=* delims= " %%a in (%Server%\%PCList%) do ( echo Loading workstation name... echo. ping %%a | find "Reply" > nul if errorlevel 1 (echo %%a, OFFLINE >> "%ReportN%" echo %%a not found... echo %%a>> "offline_machines.txt" echo. echo. %windir%\system32\ping.exe -n 2 127.0.0.1>nul ) else ( echo Scanning %%a for MAC address... for /f "tokens=1 delims= " %%i in ('getmac /s %%a /U %%a\administrator /P ADD_PASSWORD') do set MAC=%%i :: NOTE ---------------------------------------------------------------------------------------- :: You could add a different routine here, such as copy a setup file :: to the computer's UNC, then launch that file using psexec.exe :: That would allow you to remotely install apps to a list of computers :: ------------------------------------------------------------------------------------------------- :: Write computer name and mac address to your report echo %%a, !MAC! >> "%ReportN%" %windir%\system32\ping.exe -n 2 127.0.0.1>nul echo. echo. ) ) pause endlocal exit /b 0