Hello @Arixx ,
Thanks for the clear, security-conscious framing.
The following is what the documentation actually supports, and why it doesn't fit the "uninstalled app on the USB" requirement:
1. AutoPlay (content / device events)
AutoPlay can present your app as a user-consented option when a volume or device is connected, but only for a pre-defined event (for example StorageOnArrival, ShowPicturesOnArrival, WPD\ImageSource) or a CustomEvent you declare in an autorun.inf. Crucially, autorun.inf here only names an event. An installed UWP app that declares AutoPlay Content or AutoPlay Device in its package manifest is what actually handles it. autorun.inf does not launch an .exe from the drive.
2. UWP device apps + device metadata You can associate an app with your device via device metadata so it shows up as the AutoPlay handler, but the docs state plainly that "your app can't install automatically without device metadata," and even with metadata the association is to a Store/UWP app, not an arbitrary executable running from the USB. Also note this technology is on the way out:
Device metadata is deprecated and will be removed in a future release of Windows.
- AutoPlay for UWP device apps
- Talking to USB devices, start to finish (Implement AutoPlay activation)
3. Windows App SDK There is currently no documented or planned equivalent of "UWP device apps" in the Windows App SDK, so that isn't a forward-looking path either.
Closest officially supported architectures
- Installed app + AutoPlay registration. Install AEGIS on the PC, register it as an AutoPlay handler via the app manifest, and handle activation when the device is connected. This is the fully supported model, but it conflicts with your "not preinstalled" requirement.
- UWP device app + device metadata. Associate the device with a UWP app and declare
AutoPlay Device, handlingOnActivatedand readingDeviceInformation.Id. This works, but relies on the deprecated device-metadata path. - General AutoPlay option without device metadata. AutoPlay can still offer an already-registered app as an option, but it will not auto-install anything.
Since your goal is a portable diagnostic/repair tool that runs on machines where nothing is pre-installed, the realistic supported options are:
- Manual launch from the drive. The technician opens the USB in File Explorer and runs the executable. This is the standard, expected model for portable tools. There is no auto-launch, but it is fully supported and requires no installation.
- Bootable USB (WinPE / Windows PE). For a true "plug in and run without touching the installed OS" repair workflow, boot the machine from the USB into a WinPE environment. This is the officially supported architecture for diagnostic and recovery tooling that must run independently of the installed Windows image.
So, to directly answer your follow-up: there is no supported Win32/USB mechanism that auto-launches (even with consent) an uninstalled app residing only on removable media. If you want automatic prompting, an app has to be installed or registered on the PC first. If you want a no-install experience, manual launch or a bootable WinPE image are the supported routes.
Hope this helps clarify the options. If you found my response helpful or informative, I would greatly appreciate it if you could follow this guide for your confirmation.
Thank you.