Page 1 of 1

Log removable device

Posted: 22 Apr 2010 23:54
by phillid
Hey. I want to make a batch file log when my pen-drive is plugged into a computer. So far, I have this code:

Code: Select all

@echo off
rem Security program which logs computer data to track where my pen-drive has been.
date /t>>log.log
time /t>>log.log
echo Operating System:   %OS%>>log.log
echo Computer Name:      %userdomain%>>log.log
echo Username:           %username%>>log.log
echo Userpath:           %userprofile%>>log.log
echo. >>log.log


But I need it to automatically log this as soon as it's plugged in. My computer admin has disabled the execution of copying and opening commands in 'autorun.inf' so I can't use that.
Will I have to put the program on the computer instead? If so, how would I make the computer 'sense' when a drive is plugged in?
Thanks