Automatic copy from USB drive to PC on plug-in
7 hours ago, nerdv2 said:Are you sure that autoplay and autorun are enabled?
Enabling autorun/autoplay is bad idea security-wise.
You could force it to be enabled via group policy.
https://www.techrepublic.com/article/how-to-disable-autoplay-and-autorun-in-windows-10/
If you have time, prefer to detect the device dynamically with C# using InteropServices.
https://www.codeguru.com/columns/dotnet/detecting-usb-devices-using-c.html
And you can execute the batch script or even customize it yourself.
It probably could be done if I knew any programming at all.
I found a solution though: I looked up the event ID and source when the external SSD gets plugged in, then I used that as a trigger in Event planner to start the copy "script" stored on the external SSD.
However then I was running into an issue where if I plug in another external drive, it starts the copy if the external SSD is still connected. I solved that by making a more detailed filter for the trigger event as shown:
<QueryList> <Query Id="0" Path="Microsoft-Windows-Ntfs/Operational"> <Select Path="System">*[System[Provider[@Name='Microsoft-Windows-Ntfs'] and (Level=4 or Level=0) and (EventID=98) and TimeCreated[timediff(@SystemTime) <= 10000]]] and *[EventData[Data[@Name='DriveName'] and (Data='W:')]]</Select> </Query> </QueryList>
I found out how to do that here.
This way the event "Import laptop backup" only triggers when the external SSD is inserted, and it ignores any other (NTFS) external drives.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now