Monitor USB device activity on Windows - with tray notifications, logging, and auto-start.
Tray icon with the available options
Example of a notification and some contents of the log file
USB Monitor is a lightweight, portable PowerShell utility designed to track USB device events on Windows with no external dependencies. It runs in the system tray and logs all activity to a file for future reference. Itβs ideal for:
- Identifying which USB devices connect and disconnect over time
- Diagnosing intermittent USB issues
- β‘ Real-time monitoring of USB device connections and disconnections
- π¬ Optional balloon notifications displaying device names
- π Optional automatic startup with Windows for continuous monitoring
- π Customizable polling rate interval
- π±οΈ Tray icon menu providing quick access to all functions
- ποΈ Comprehensive log file saved at
%AppData%\USBMonitor\usb_log.txt
- πΎ Persistent preferences stored in JSON at
%AppData%\USBMonitor\settings.json
- π§ Single-instance enforcement to prevent multiple runs
- π§© No external dependencies, pure PowerShell
- Download the latest version from the Releases page.
- Extract the
.exe
file and double-click it to launch the app. The application runs in the background and places an icon in the system tray to manage it.
- Right-click the tray icon to open the log file, configure the settings or quit the app.
- If enabled, balloon notifications will appear for each USB device connection or disconnection. All activity is always stored in the log file.
-
Ensure you have PowerShell 5.1 or later installed on your Windows machine.
Windows 10+ includes this by default, but you can also use PowerShell 7+ for enhanced features. -
Clone the repository locally:
git clone https://github.com/joanroig/usb-monitor.git
cd usb-monitor
To run the USB Monitor script directly without building an executable, execute:
powershell -ExecutionPolicy Bypass -File .\USBMonitor.ps1
This starts the application in your current session.
USB Monitor uses ps2exe to package the PowerShell script as a standalone .exe
:
-
Install the ps2exe module (requires internet):
Install-Module -Name ps2exe -Scope CurrentUser -Force
-
Run the build script to generate the executable:
.\bundle.ps1
This script packagesUSBMonitor.ps1
into an optimized executable located in thedist
folder.
VSCode launch configurations are provided in .vscode/launch.json
:
-
PowerShell: Launch USBMonitor
RunsUSBMonitor.ps1
directly for live debugging with breakpoints and console output. -
PowerShell: Bundle USBMonitor
Executes the build script (bundle.ps1
) to create the executable, useful for verifying packaging steps.
To use these, open VSCode in the project directory, then open the Run and Debug panel and select the desired configuration.
Releases are fully automated via GitHub Actions. Check out the workflow defined in create-release.yml
, which builds and publishes new executables on the GitHub releases page.
Icon from Flaticon by Freepik.
This project is licensed under the MIT License. See the LICENSE file for more information.