The computer has to be online for the script to work. However, if you right click the computer name in AD and select manage, it will provide you with even more info than just who's logged on (it runs msinfo32 on the client). You can also work with these variables in a user logon batch..
echo %username% >>\\server\share\PCLog.txt
echo %computername% >>\\server\share\PCLog.txt
Make sure you grant write permissions to the users to PCLog.txt
Start, Help. You'll be surprised what's there. A+/MCP/MCSE/MCDBA