https://github.com/joanroig/usb-monitor
π Monitor USB device activity on Windows - with tray notifications, logging, and auto-start.
https://github.com/joanroig/usb-monitor
device-management monitoring powershell tools tray-application usb usb-monitoring windows windows-utility
Last synced: about 2 months ago
JSON representation
π Monitor USB device activity on Windows - with tray notifications, logging, and auto-start.
- Host: GitHub
- URL: https://github.com/joanroig/usb-monitor
- Owner: joanroig
- License: mit
- Created: 2025-05-30T12:12:24.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-06-07T10:28:13.000Z (4 months ago)
- Last Synced: 2025-06-07T11:26:53.698Z (4 months ago)
- Topics: device-management, monitoring, powershell, tools, tray-application, usb, usb-monitoring, windows, windows-utility
- Language: PowerShell
- Homepage:
- Size: 90.8 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
USB Monitor
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## π Overview
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### Features
- β‘ 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## π How to use
### Installation
1. Download the latest version from the [Releases page](https://github.com/joanroig/usb-monitor/releases).
2. 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.### Usage
1. Right-click the tray icon to open the log file, configure the settings or quit the app.
2. If enabled, balloon notifications will appear for each USB device connection or disconnection. All activity is always stored in the log file.## π οΈ Development Setup
### Prerequisites
- 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+](https://aka.ms/powershell) for enhanced features.- Clone the repository locally:
`git clone https://github.com/joanroig/usb-monitor.git`
`cd usb-monitor`### Running the Application
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.
### Building the Executable
USB Monitor uses **ps2exe** to package the PowerShell script as a standalone `.exe`:
1. Install the ps2exe module (requires internet):
`Install-Module -Name ps2exe -Scope CurrentUser -Force`2. Run the build script to generate the executable:
`.\bundle.ps1`
This script packages `USBMonitor.ps1` into an optimized executable located in the `dist` folder.### Debugging with VSCode
VSCode launch configurations are provided in `.vscode/launch.json`:
- **PowerShell: Launch USBMonitor**
Runs `USBMonitor.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.
### Automated Release
Releases are fully automated via GitHub Actions. Check out the workflow defined in [`create-release.yml`](.github/workflows/create-release.yml), which builds and publishes new executables on the GitHub releases page.
## π Credits
Icon from Flaticon by Freepik.
## π License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more information.