Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Thursday, September 5, 2013 10:47 AM
Hello,
How can I disable and uninstall a specific device.
I can get device as below:
Get-WmiObject Win32_PNPEntity | Where-Object {$_.Name -like "*$DeviceName*"}
PS: I want to do belows scenerio by Powershell (V2) in stand-alone W7 computer
All replies (4)
Thursday, September 5, 2013 1:06 PM
I'm not sure about your precise circumstance - but this might help you:
# just testing identifying drivers w/ pnpentities
gwmi win32_pnpentity | % { gwmi -Query "select * from win32_systemdriver where caption=`"$($_.caption)`"" } | ft
# then something like this to remove stop and remove. I've not tested
gwmi -Query "select * from win32_systemdriver where caption=`"THING_YOU_WANT_REMOVED`"" } | % { $_.StopService();$_.Delete() }
Good luck!
G. Samuel Hays, MCT, MCSE 2012, MCITP: Enterprise Admin
twitter:twitter.com/gsamuelhays
Thursday, September 5, 2013 1:20 PM
Here are some options for you to look into:
1. Device Management PowerShell Cmdlets
2. The DevCon command-line utility
3. How to Manage Device Drivers with Command Line
Thursday, September 5, 2013 2:02 PM
If we're strictly talking about requirements - then ebasaranoglu specified he wants a powershell (version 2) solution. If those requirements are strict, then that eliminates those options. 1) requires powershell v3, and 2 and 3 are non-powershell solutions.
G. Samuel Hays, MCT, MCSE 2012, MCITP: Enterprise Admin
Blog:
gsamuelhays.blogspot.com
twitter:twitter.com/gsamuelhays
Sunday, September 8, 2013 10:12 AM
For NETBT; << gwmi -Query "select * from win32_systemdriver where caption=`"NETBT`"" }>> can get NETBT device and shows that it is running.
But when I run << gwmi -Query "select * from win32_systemdriver where caption=`"NETBT`"" } | % { $_.StopService();$_.Delete() } >> it doesn't stop service. It is still running.
Tehre are 2 methods as SoprService and Delete when we check using Get-Member.
Do you have any other suggestion?