Skip to content

Instantly share code, notes, and snippets.

@spacemeowx2
Created October 26, 2021 17:31
Show Gist options
  • Save spacemeowx2/76cdd6f4093340f78bef919ea326d87a to your computer and use it in GitHub Desktop.
Save spacemeowx2/76cdd6f4093340f78bef919ea326d87a to your computer and use it in GitHub Desktop.
Clear all UPnP devices
$upnppath = 'HKLM:\System\CurrentControlSet\Enum\SWD\DAFUPnPProvider'
$upnpdevices = Get-ChildItem $upnppath | Get-ItemProperty -name 'FriendlyName'
foreach ($upnpdevice in $upnpdevices) {
if ($upnpdevice.'FriendlyName' -ne 'I wont be deleted') {
$name = $upnpdevice.PSChildName
echo "Deleting $name"
pnputil /remove-device "SWD\DAFUPnPProvider\$name"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment