This Powershell script will get a list of all hidden devices from Device Manager and remove them. Use this after moving or cloning a drive to a new physically different Computer/Motherboard.
Copy to Clipboard
$unknown_devices = Get-PnpDevice | Where-Object{$_.Status -eq 'Unknown'}
ForEach( $dev in $unknown_devices ){
pnputil /remove-device $dev.InstanceId
}
A more advanced (and untested by me) script is available here: https://github.com/istvans/scripts/blob/master/removeGhosts.ps1 |