So here is the situation to make sure it's well understood.
I have 2 HP packages that I need to install on Windows 10 systems to have the Function Keys reacting properly (for Example Brightness up-down etc).
As a good practice we always create our script with Install / Uninstall option.
One of the package is a simple HP Service Framework this is an Easy Install / Uninstall.
The second package is actually drivers for the keyboard and I cannot see it as an app (so cannot be easily uninstalled). It's only updating the drivers on the computer, so the Generic Keyboard becomes the HP Keyboard.
I found how to remove the Driver package on the computer, so this way once I can uninstall the keyboard it won't reinstall with that driver, but take the default PS2 drivers.
$oemfiles = Get-ChildItem c:\windows\inf\oem*.inf
foreach($file in $oemfiles){
if(get-content $file | select-string -pattern 'hpkeyboard' -SimpleMatch)
{PnPUtil /Delete-Driver $file.name /force }
}
So now that I did that, how can I uninstall the actual device. (As if I would go in Device Manager and Right Click Uninstall the Keyboard).
PnPUtil only removes the package from Windows. Disable-PNPDevice, well I don't want to disable it, I want to remove it from the system so it goes back to the Default Keyboard.
If you are asking why I want to remove the Device completely, is that if you leave this keyboard there, the Function keys are looking for the HP Software Framework and gives a constant error message if you press on the key. (Which is anoying).