r/PowerShell
•
u/MartinGC94
•
Apr 04 '26
•
1
1
Script Sharing DeviceManager - Module for managing devices and drivers on Windows
I have created a new module which pretty much does anything that Device Manager does but from PowerShell. This IMO has been sorely missing for Windows Server Core because the existing tools (PnpDevice PS module and pnputil.exe) have been missing features or have not been very PS friendly (thanks to pnputil not being a PS module).
The module is open source and can be found here: https://github.com/MartinGC94/DeviceManager
And naturally it has also been published to the gallery so it can be installed with: Install-Module DeviceManager.
The GitHub page already includes some examples, but here's a few more. First 2 examples of things that the existing tools cannot do AFAIK:
Rollback to a previous driver: Get-Device -DeviceClass Display | where Name -EQ "NVIDIA GeForce GT 710" | Undo-DeviceDriverUpdate
Force installing a driver on a device, despite it not being marked as compatible (Useful because Intel arbitrarily blocks consumer NICs from working on Windows Server):
$Driver = Get-DeviceDriver -DeviceClass Net | where Description -EQ 'Intel(R) Ethernet Connection I218-LM' | sort | select -First 1
Get-Device | where Name -EQ "Ethernet Controller" | Install-DeviceDriver -Driver $DriverSomething that surprised me a bit is that the device driver update dialog actually works on Server core, so if you want you can even do it with a mix of PowerShell and GUI like this: Get-Device | where Name -EQ "Ethernet Controller" | Show-DeviceUpdateWizard
Check it out and leave feedback if you want.
View all comments
Show parent comment
2
u/MartinGC94 Apr 06 '26
Cheers. I actually wanted to make this years ago when I was relatively new to P/Invoke and C# in general but the documentation just went over my head like: "Wtf is a Device Information Set? How do I define that???" then I just gave up on it and did some other stuff.
When I realized it was just a pointer I could define as
IntPtrit became much easier to understand. Then I just had to look through the list of function names to find whatever seemed interesting and relevant to what Device Manager does and implement them.