function Get-DevicesUnplugged {
    param (
        [string]$comp
    )
    Write-Progress -Activity "Getting devices for $name" -Status 'Collecting USB devices' -PercentComplete 10 -ParentId 1
    if ($comp -eq $env:COMPUTERNAME) {
        $usb += Get-PnpDevice -Status UNKNOWN | Select-Object @{N="Description";E={$_.FriendlyName}},@{N="DeviceID\SerialNumber";E={$_.InstanceID}} | Add-Member -NotePropertyName Manufacturer -NotePropertyValue 'Unknown' -PassThru
    } else {
        $usb += Invoke-Command -ComputerName $comp -SessionOption $(New-PSSessionOption -NoMachineProfile) -ScriptBlock {
            Get-PnpDevice -Status UNKNOWN | Select-Object @{N="Description";E={$_.FriendlyName}},@{N="DeviceID\SerialNumber";E={$_.InstanceID}} | Add-Member -NotePropertyName Manufacturer -NotePropertyValue 'Unknown' -PassThru
        }
    }
    $usb | Add-Member -NotePropertyName Type -NotePropertyValue USB
    $usb | Add-Member -NotePropertyName AttachedComputer -NotePropertyValue $comp
    $usbi = 0
    $friendlyNames = $usb | ForEach-Object {
        $usbi++
        Write-Progress -Activity "Getting devices for $name" -Status "Parsing USB Devices ($usbi/$($usb.Length)" -PercentComplete (($usbi * (80-10) /  $usb.Length )+10) -ParentId 1
        Write-Output $_
    } | Select-Object -ExpandProperty 'DeviceID\SerialNumber' | FindUSBDevice
    for($usbi = 0; $usbi -lt $usb.Count; $usbi++){
        Write-Progress -Activity "Getting devices for $name" -Status "Populating fields ($usbi/$($usb.Length)" -PercentComplete (($usbi * (90-80) /  $usb.Length )+80) -ParentId 1
        if(!$friendlyNames[$usbi]){ continue }
        $usb[$usbi].Manufacturer = $friendlyNames[$usbi].Manufacturer
        if($usb[$usbi].Manufacturer.Length -le 5){ continue }
        if($usb[$usbi].Manufacturer.Substring(0,5) -eq '[SHS]'){
            $usb[$usbi].Type = 'SHS Issued USB'
            $len = $usb[$usbi].Manufacturer.Length -1
            $usb[$usbi].Manufacturer = $usb[$usbi].Manufacturer[5..$len] -join ''
        }
        if($friendlyNames[$usbi].Description){
            $usb[$usbi].Description = $friendlyNames[$usbi].Description
        }
    }
    Write-Progress -Activity "Getting devices for $name" -Status 'Sorting out duplicate devices' -PercentComplete 90 -ParentId 1
    $usb = $usb | Sort-Object Manufacturer,Description
    for ($i = 0; $i -lt $usb.Count - 1; $i++) {
        if($usb[$i].Manufacturer -eq $usb[$i+1].Manufacturer -and $usb[$i].Description -eq $usb[$i+1].Description){
            $usb[$i].Manufacturer = '__DUPE__'
        }
    }
    $usb = $usb | Where-Object -Property Manufacturer -NE '__DUPE__'
    $usb = $usb | Sort-Object Type
    
    $out = @()

    foreach($item in ($monitors + $usb)){
        $item.PSObject.TypeNames.Insert(0,'GetPC.Devices')
        $out += $item   
    }
    $item = [PSCustomObject]@{ }
    $item.PSObject.TypeNames.Insert(0,'GetPC.Devices')
    $out += $item
    
    Write-Output $out
}

