Hey guys,
So I’ve been looking for a way to delete a hardware device, preferably using some sort of one-liner.
Using “Get-PnpDevice” you can list all devices, but strangely enough actually deleting them isn’t an option.
Now I know, there’s a function out there that relies on the “Win32.SetupApi” that can list and delete devices.
But I haven’t been able to filter out the command to just delete a device.
At this moment I’m stuck with this line, but I can’t wrap my head around how it actually works:
[pre][Win32.SetupApi]::SetupDiRemoveDevice($Devs, [ref]$DevInfo)[/pre]
Does anyone out here know a way to delete a device in a PowerShell fashion?
Regards,
BM