X
X
xorebx2014-12-26 13:27:27
PowerShell
xorebx, 2014-12-26 13:27:27

How to handle the event of pulling out a flash drive in windows?

There is a task - to do certain actions in the system when the flash drive is physically pulled out of the usb socket.
For macOS it looks like this:

#!/bin/bash
tail -f /var/log/system.log | while read n; do
  if 
  then
    echo "blablabla";
  fi
done

What will it look like for windows using cmd or powershell?
PS In windows I am oak

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
asdz, 2014-12-26
@asdz

I hasten to please you that everything is very simple))
When you connect or disconnect a flash drive, events are generated in the Microsoft-Windows-DriverFrameworks-UserMode/Operational log. Right-click on the desired event, select "Bind task to event" and set up a task that will automatically run when the specified event occurs.

X
xmoonlight, 2014-12-26
@xmoonlight

And who wants to rummage himself - then ALMOST everything is simple))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question