问题
I run automation that installs a preset OS /w Drivers and configuration. I inherited the automation second hand and there's a lot to it. I have a system with hybrid graphics and it hands on verifying the display drivers. Now, I can walk over to the machine, open device manager, right click on one of the graphics devices, click uninstall (i do not delete the driver files) and then the automation continues. Once its done, the system restarts and both device drivers are back. I am wondering if there is a powershell command i can run to do the same task through automation?
what do you guys think!
回答1:
You can do this using WMI instance:
get-wmiobject -Query "select * from win32_systemdriver where caption=`"THING_TO_REMOVE`"" } | ForEach { $_.StopService()
$_.Delete()
}
回答2:
It's not powershell, but I've always used the command line version of device manager called devcon: https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon
来源:https://stackoverflow.com/questions/60638900/uninstall-device-from-powershell