[REQUEST] Create a log file when a USER insert a usb

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
MeSH
Posts: 30
Joined: 17 Feb 2013 09:58

[REQUEST] Create a log file when a USER insert a usb

#1 Post by MeSH » 08 Feb 2018 01:19

Good day to all DosTips admin, staff and members here...

I would like to request a script when a user insert a usb the script will log it. These are the info inside a log file:

<date created>: USB Connected/Disconnected: <computer name>: <time inserted/eject>

Example:

Code: Select all

02-08-2018: USB Connected: PC01: 10:00:00
02-08-2018: USB Disconnected: PC01: 10:05:00
02-08-2018: USB Connected: PC05: 12:00:00
02-08-2018: USB Disconnected: PC05: 13:00:00
02-08-2018: USB Connected: PC16: 14:30:00
02-08-2018: USB Disconnected: PC16: 14:35:00
Note:
it's up to you if it's in 12 or 24 hour format.
It will not create a new log file, it will only update it (if it's possible).

Specification can run also in windows xp and above

is this possible using a script? I requesting this script because I can't find in the internet that fits on our system...
I found USBLog view but when I run it it won't create a log file... I will apply this on my work since we are dealing a students and our CCTV is not enough... we have many blind spots... so I decided to go back here in DosTips to ask for help again. Thanks

UPDATE:
the log file can save on a remote computer so we can isolate it. just tell me where in the part of the code to edit it... thanks again :-)

Squashman
Expert
Posts: 4484
Joined: 23 Dec 2011 13:59

Re: [REQUEST] Create a log file when a USER insert a usb

#2 Post by Squashman » 08 Feb 2018 11:00

I can think of two ways to do this.

1) Create a Windows Schedule task that triggers for the specific event that happens when a USB device is inserted into the computer.

2) Use Microsoft's Log Parser to read the system logs for that specific event.

Happy Researching.

MeSH
Posts: 30
Joined: 17 Feb 2013 09:58

Re: [REQUEST] Create a log file when a USER insert a usb

#3 Post by MeSH » 08 Feb 2018 19:50

Good day! I installed microsoft parser but its only applicable to windows 7 and up... our computers here are mixed with windows xp & 7... So I decided to post here if ever someone can create a script for it so it can run any version of windows os v :-)

ShadowThief
Expert
Posts: 1166
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: [REQUEST] Create a log file when a USER insert a usb

#4 Post by ShadowThief » 08 Feb 2018 21:55

XP stopped being supported two years ago; come into the 21st century already.

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: [REQUEST] Create a log file when a USER insert a usb

#5 Post by penpen » 09 Feb 2018 04:26

The Log Parser should be still available for Win XP professional edition:
https://www.microsoft.com/en-us/downloa ... x?id=24659.

penpen

MeSH
Posts: 30
Joined: 17 Feb 2013 09:58

Re: [REQUEST] Create a log file when a USER insert a usb

#6 Post by MeSH » 09 Feb 2018 18:07

ShadowThief wrote:
08 Feb 2018 21:55
XP stopped being supported two years ago; come into the 21st century already.
I don't have a choice since I am working in a government... it's hard to request a brand new PC's it takes half or years just to approve a request...

MeSH
Posts: 30
Joined: 17 Feb 2013 09:58

Re: [REQUEST] Create a log file when a USER insert a usb

#7 Post by MeSH » 09 Feb 2018 19:28

penpen wrote:
09 Feb 2018 04:26
The Log Parser should be still available for Win XP professional edition:
https://www.microsoft.com/en-us/downloa ... x?id=24659.

penpen
thanks :-)

Post Reply