Skip to content

Instantly share code, notes, and snippets.

@zeroxia
Created April 27, 2023 10:34
Show Gist options
  • Save zeroxia/7eb9f9f36c032a8ec03b080c5fae595f to your computer and use it in GitHub Desktop.
Save zeroxia/7eb9f9f36c032a8ec03b080c5fae595f to your computer and use it in GitHub Desktop.

Revisions

  1. zeroxia created this gist Apr 27, 2023.
    22 changes: 22 additions & 0 deletions remove_zombie_software_devices.ps1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    ##
    ## Some stupid application (like "鲜时光") in Android TV system advertises itself
    ## with different identities, causing Windows system assuming there are many many
    ## such software devices.
    ## You can open "Settings" app and select "Devices" to browse those devices. Or they
    ## are also listed in "Device Manager" under the category of "Software Devices".
    ##
    ## To remove them all together without manually right clicking each instance and
    ## selecting "Uninstall", here is a PowerShell script stolen from stackoverflow:
    ##
    ## https://stackoverflow.com/questions/60638900/uninstall-device-from-powershell
    ##
    ## Save this file as "remove_zombie_software_devices.ps1" and execute it with a
    ## privileged PowerShell terminal (i.e., run as Administrator).
    ##
    ## Remember to update the clause "$_.Name -Like "XXX"" in the following line to your
    ## target zombie device names.
    foreach ($dev in (Get-PnpDevice | Where-Object { $_.Name -Like "*我的鲜时光*" } )) {
    Write-Host 'Name: '$dev.Name' | InstanceId: '$dev.InstanceId
    &"pnputil" /remove-device $dev.InstanceId
    &"pnputil" /scan-devices
    }