Log removable device

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
phillid
Posts: 109
Joined: 03 Apr 2010 20:27
Location: Wellington, New Zealand
Contact:

Log removable device

#1 Post by phillid » 22 Apr 2010 23:54

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

Post Reply