Powershell Question

Ron Bonney 21 Reputation points
2021-08-03T19:51:46.073+00:00

I have several subkeys I need to delete the "UpperFilters" key from a root key:

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\FTDIBUS

The problem I am encountering is that when trying to find the UpperFilters key, I find that the registry entries vary within the root key folder:

120293-q2.jpg

I found a way to identify which of these subkeys contain my offending key by running this command in PowerShell:

120263-q1.jpg

Where I am hoping someone can help me is how can I use PowerShell to search for the "UpperFilters" key that can exist in any of these random named subkeys "\VID_0403+PID_60*\0000" and once found, delete the key.

I would like to have an automated way of turning off "Serial Enumeration" for the FTDI USB Serial Port driver, and deleting this key will toggle this option on/off in device manager:

120284-q3.jpg

The issue I am having is that with every new batch of controllers I order, when assembling my units, the 'VID_0403+PID_60' section changes in the registry. I assume I am getting different versions of the FTDI chip on my microcontroller. I can't change the FTDIPORT.INF file to not install the "Serial Enumeration" setting, because that results in an "unsigned driver" which causes Windows 10 LTSC x64 to not load the driver at all and my clients aren't even aware they are using Windows because this device is a integrated controller for a bigger system so using the F8 method to load the driver won't work. I run it in headless mode to perform a variety of functions. Leaving this setting on has caused instability with the way my program talks to the chip and I would like to create a powershell script that can look for the "UpperFilters" key no matter which subkey it winds up in and delete it when I install my image.

I appreciate any help anyone can offer. Thank you!

Ron

Windows for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} votes

Accepted answer
  1. Rich Matheisen 47,901 Reputation points
    2021-08-03T21:29:21.263+00:00

    You shouldn't be using "ControlSet001". That's a backup (of sorts) for "CurrentControlSet" (which is where you should be looking).

    Try something like this:

    Get-ItemProperty hklm:HKEY_LOCAL_MACHINE\SYSTEM\ControlSet\Enum\FTDIBUS\* |
        ForEach-Object{
            $_.psobject.properties |
                ForEach-Object{
                    if ($_.Name -eq 'YourNameHere'){
                        "Found it"
                        $_.Name + " : " + $_.Value
                    }
                    # change the value here using:
                    # Set-ItemProperty
                    # or remove the property using:
                    # Remove-ItemProperty
                }
    }
    

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.