Tuesday, February 13, 2024

#106: Get list of all the USB devices installed in you system using Powershell

Below is small snippet that can be used to get the list of all the usb devices installed.  


# Get all USB devices
$usbDevices = Get-PnpDevice -Class USB

# Output information about each USB device
foreach ($device in $usbDevices) {
    Write-Output "Device ID: $($device.InstanceId)"
    Write-Output "Description: $($device.Description)"
    Write-Output "Manufacturer: $($device.Manufacturer)"
    Write-Output "Status: $($device.Status)"
    Write-Output "-----------------------------"
}


Hope this was easy to understand the code. 

Thanks!

No comments:

Post a Comment

#112: How to handle xml document in Powershell?

 In PowerShell, you can handle XML data using various cmdlets and methods provided by the .NET Framework. Here's a basic guide on how to...