using wolcmd
Depicus Wake On Lan Command Line

Code:
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
rem %1 is input room prefix

del temp.txt
set mac=
set ip=

dsquery computer -limit 5000 dc=domain,dc=lancs,dc=sch,dc=uk | find "%1" /I >> temp.txt

for /f "tokens=2 delims==," %%a in ('type temp.txt') do ( 

if exist \\server\share\macs\%%a.log for /f "tokens=* delims= " %%b in ('type \\server\share\macs\%%a.log') do set mac=!mac! %%b

wolcmd !MAC! %%a.domain.lancs.sch.uk 255.255.0.0 7
set mac=
set ip=

)
del temp.txt

ENDLOCAL
requires common room prefixes, some means to know mac addresses. we have log files.