/ _ \ \_\(_)/_/ _//"\\_ more on JOHLEM.net / \ 0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0o0 USB Device Management Commands: ------------------------------- 1. **Get-PnpDevice** List all Plug and Play (PnP) devices, including USB devices. Syntax: Get-PnpDevice -Class "USB" Example: Get-PnpDevice | Where-Object { $_.InstanceId -match "USB" } 2. **Get-UsbDevice** (Requires Custom Script) List all connected USB devices. Example Script: Get-WmiObject -Query “SELECT * FROM Win32_USBHub” | Select-Object DeviceID, Description, PNPDeviceID 3. **Disable-PnpDevice** Disable a specific USB device. Syntax: Disable-PnpDevice -InstanceId "DeviceInstanceId" -Confirm:$false Example: Disable-PnpDevice -InstanceId "USB\VID_1234&PID_5678\6&3A2C123&0&2" -Confirm:$false 4. **Enable-PnpDevice** Enable a specific USB device. Syntax: Enable-PnpDevice -InstanceId "DeviceInstanceId" -Confirm:$false Example: Enable-PnpDevice -InstanceId "USB\VID_1234&PID_5678\6&3A2C123&0&2" -Confirm:$false 5. **Remove-PnpDevice** Uninstall a USB device from the system. Syntax: Remove-PnpDevice -InstanceId "DeviceInstanceId" -Confirm:$false Example: Remove-PnpDevice -InstanceId "USB\VID_1234&PID_5678\6&3A2C123&0&2" -Confirm:$false 6. **Get-Volume** (For USB Drives) Display information about volumes, including USB drives. Syntax: Get-Volume | Where-Object { $_.DriveType -eq 'Removable' } 7. **Eject-Volume** Safely eject a USB drive. Syntax: Eject-Volume -DriveLetter "E" Example: Eject-Volume -DriveLetter "E" 8. **New-Partition** on USB Create a new partition on a USB drive. Syntax: New-Partition -DiskNumber 2 -Size 8GB -AssignDriveLetter 9. **Format-Volume** on USB Format a USB drive with a specific file system. Syntax: Format-Volume -DriveLetter "E" -FileSystem FAT32 -NewFileSystemLabel "USBDrive" 10. **Get-Partition** on USB List all partitions on a USB drive. Syntax: Get-Partition -DiskNumber 2 11. **Remove-Partition** on USB Delete a partition from a USB drive. Syntax: Remove-Partition -DriveLetter "E" -Confirm:$false 12. **Get-Disk** (USB Drives) List all disks and identify USB drives. Syntax: Get-Disk | Where-Object { $_.BusType -eq "USB" } 13. **Initialize-Disk** (USB) Initialize a new USB drive. Syntax: Initialize-Disk -Number 2 14. **Set-Disk** (USB Write Protection) Enable or disable write protection on a USB drive (where supported). Syntax: Set-Disk -Number 2 -IsReadOnly $true Example: Set-Disk -Number 2 -IsReadOnly $false 15. **Mount-DiskImage** (Mount USB ISO) Mount an ISO file as a virtual USB drive. Syntax: Mount-DiskImage -ImagePath "C:\Path\To\Image.iso" 16. **Dismount-DiskImage** (Unmount USB ISO) Unmount a mounted ISO file. Syntax: Dismount-DiskImage -ImagePath "C:\Path\To\Image.iso" +----------------------------------------------------------+ | Note: USB device management commands enable detailed | | control over USB devices, including listing, | | enabling, disabling, formatting, and ejecting | | USB drives, as well as managing USB drive settings| | like partitions and read-only status. | +----------------------------------------------------------+