Remove Device from Powershell RRS feed

  • Question

  • Hi All,

    I would like to delete existing paired devices from Wireless Display & Docks devices from Windows 10 (I can do manually from Start  > Settings  > Devices > Bluetooth & other devices. Under Wireless displays & docks, select the wireless display or adapter, then select Remove device > Yes) but I'm looking the procedure to script these steps because Windows remembers the devices already paired. 

    Via DevCon or via DeviceMangament PS module seems that I'm able to delete successfully the devices but after a rescan or a Windows restart, the device still again present and paired on Windows:

    PS C:\>Get-Device | where-Object -Property Name -like "WirelessDisplay-TEST"

    Name                 Enabled Class      InstanceId
    ----                 ------- -----      ----------
    WirelessDisplay-TEST True    4294967295 SWD\WIFIDIRECT\9A:5F:D3:BE:6B:ED
    WirelessDisplay-TEST True    4294967295 SWD\WIFIDIRECT\9A:5F:D3:BE:6B:ED#MIRACAST

    PS C:\>Get-Device | where-Object -Property Name -like "WirelessDisplay-TEST" | Uninstall-Device -Confirm:$false

    PS C:\>

    also via DevCon.exe, same result:

    c:\temp\devcon.exe\x64>devcon /r remove @SWD\WIFIDIRECT\*
    SWD\WIFIDIRECT\9A:5F:D3:BE:6B:ED                            : Removed
    SWD\WIFIDIRECT\9A:5F:D3:BE:6B:ED#MIRACAST                   : Removed
    2 device(s) were removed.

    After the commands, the device is not anymore discoverable via network but after an hardware rescan or a Windows reboot, the device still again present and user no need to do again the pairing.

    I need to force the user to do the pairing with this device everytime PIN change and I dont want that Windows remember the association without ask to enter PIN.

    Please help, thanks!

    • Edited by gueant Wednesday, December 5, 2018 4:08 PM
    Wednesday, December 5, 2018 4:07 PM

All replies

  • Sorry but this is not the correct forum for this.  You may need to contact MS support.  Devices that are visible will always be discovered on a scan.  The best you can do is to unpair and then repair the device.


    Wednesday, December 5, 2018 8:20 PM
  • Hello jrv!

    Yes, I agree that devices must be always discoverable on a scan but my question is where Windows store pairing information? 

    I dont understand why by remove manually the device I delete this kind of stored info and the next time a do a network scan, I see the device and this ask me to enter the PIN for the association. If I do the same via script the device was removed but PIN still stored somewhere and Windows never ask to pair again the device.

    Any suggestion?


    Thursday, December 6, 2018 7:15 PM
  • There is an XML file hidden in Windows that maintains a list of devices.  There area also scripts in the Gallery that can completely remove the pairing information.


    Thursday, December 6, 2018 9:08 PM
  • Thank you, this is what I'm looking for...

    Could you please ping me the link? I'm not able to find it out


    Friday, December 7, 2018 3:14 PM
  • Here is the link: https://gallery.technet.microsoft.com/


    Friday, December 7, 2018 3:17 PM
  • ok. Can you share the link for the script you mentioned or where is stored this XML file?.

    Thank you

    Friday, December 7, 2018 4:58 PM
  • I don't have a link.  It was from memory.


    Friday, December 7, 2018 6:06 PM
  • Hello,

    the info seems not stored in any file or key. Even by remove the devices, pairing info still remembered from Windows. In my opinion by click the button "Remove Device" in addition to remove the devices, some internal methods for unpairing should be invoked by Windows API otherwise I have no explanation..

    Monday, December 10, 2018 5:15 PM
  • Hi,

    Was your issue resolved?

    If you resolved it using our solution, please "mark it as answer" to help other community members find the helpful reply quickly.

    If you resolve it using your own solution, please share your experience and solution here. It will be very beneficial for other community members who have similar questions.

    If no, please reply and tell us the current situation in order to provide further help.

    Best Regards,


    Just do it.

    Friday, December 14, 2018 7:32 AM
  • Thank you LeenSeenLi

    The issue is not solved and honestly nothing is changed from my last answer. 

    Basically I'm not able to automatically unpair the devices except by do manual action from Windows settings.

    Best Regards,


    Monday, December 17, 2018 9:19 AM
  • Based on the complexity and the specific situation, we need to do more researches. If we have any updates or any thoughts about this issue, we will keep you posted as soon as possible. Your kind understanding is appreciated. If you have further information during this period, you could post it on the forum, which helps us understand and analyze this issue comprehensively.
    Sorry for the inconvenience and thank you for your understanding and patience.

    Just do it.

    Monday, December 24, 2018 6:23 AM