October 16, 2021

Software Mile.com

Latest Software News and Hacks

Query if device is enabled and if so disable it?

Folks of PowerShell,

I have a weird sequence of events. We have a vendor who is trying their best to resolve an issue for us, but in the mean time we have a workaround which involves disabling a device in the device manager.

I have a single script that can run on start up and disables the device, the hiccup is…a reboot is required as the drive we’re disabling controls a display adapter and without disabling this extra adapter things do not work properly at all.

I am looking at the Get-PnpDevice, I have looked at querying it with say :

$DisableTouch = Get-PnpDevice | where {$_.friendlyname -like "HID-compliant touch screen*"} 

But then if I perform a $DisableTouch.Status it just returns “OK” whether it is disabled or not… I am trying to find out if there is a way to make it return really anything else, or another way to gather if the device is enabled or disabled so that the PC does not get stuck in a reboot loop.

We currently disable it using :

$DisableTouch = Get-PnpDevice | where {$_.friendlyname -like "HID-compliant touch screen*"} $DisableTouch | Disable-PnpDevice -Confirm:$false 

Yes, we have tried disabling and uninstalling the device driver, but after reboot it comes back no matter what and it causes us a lot of headache, so any help to attempt to bandaid this would be appreciated.

submitted by /u/WetEnergy
[link] [comments]

Go to Source of this post
Author Of this post: /u/WetEnergy
Title Of post: Query if device is enabled and if so disable it?
Author Link: {authorlink}