TobiasPSP / Modules.DeviceManagement

PowerShell module to manage devices and drivers
MIT License
12 stars 0 forks source link

Error for Get-Device #3

Open eabase opened 1 year ago

eabase commented 1 year ago

Get-Device | Out-GridView

Gives: Get-Device: Error calling SetupDiGetDeviceProperty()

ethzero commented 1 year ago

Same, for fresh install. Windows 10/PowerShell 7.2.11

BertV1 commented 6 months ago

Same thing. Even if i try to filter on certain devices. This command was the only reason I acquired the module (alternative to using WMI)

TobiasPSP commented 6 months ago

Did you try running it with admin privileges? I need to check but it may require elevation to get read access.

BertV1 commented 6 months ago

Yes, I did, for me this did not help. @TobiasPSP I've read somewhere that this function requires Vista or later, but I am running this on W10/pwsh 7.0.0

TobiasPSP commented 6 months ago

I‘ll investigate today, too. At publishing time, this obviously worked for me. Did you ever use it with PowerShell 5 where it was originally created? Thanks!

BertV1 commented 6 months ago

I've tried it with PS5.1 (admin mode); it produces the same error:

get-device : Error calling SetupDiGetDeviceProperty()
At line:1 char:1
+ get-device
+ ~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-Device], Win32Exception
    + FullyQualifiedErrorId : System.ComponentModel.Win32Exception,DeviceManager.Commands.GetDeviceCommand
TobiasPSP commented 6 months ago

I just reinstalled the module on a test system running Windows 10. Both examples work as expected. I am displaying below only the first 10 results to not overflow the thread, but I can confirm that without that limitation, still all information is outputted without errors:

PS C:\> Get-Driver | Select-Object -First 10

Description                    ManufacturerName  ProviderName DriverDate
-----------                    ----------------  ------------ ----------
TKR TerboLine 19k2             TKR               Microsoft    21.06.2...
Remote Desktop Device Redir... Microsoft         Microsoft    21.06.2...
Generic USB-EEM Network Ada... Microsoft         Microsoft    21.04.2...
Windows KDNET USB-EEM Netwo... Microsoft         Microsoft    21.04.2...
Windows KDNET USB3.0-EEM Ne... Microsoft         Microsoft    21.04.2...
Windows KDNET USB Network A... Microsoft         Microsoft    21.04.2...
Standard Serial over Blueto... Microsoft         Microsoft    21.06.2...
SDF Launcher                   Microsoft         Microsoft    21.06.2...
Microsoft RemoteFX Synth3D ... Microsoft         Microsoft    21.06.2...
Simple Device Orientation S... Microsoft         Microsoft    21.04.2...

PS C:\> Get-Device | Select-Object -First 10

Name                                IsPresent HasProblem InstallState
----                                --------- ---------- ------------
HID-compliant system controller    True      False      InstallState...
HID-compliant vendor-defined dev... True      False      InstallState...
Intel(R) Control Logic             True      False      InstallState...
Generic Attribute Profile          True      False      InstallState...
Killer Networking Software         True      False      InstallState...
HID-compliant consumer control d... True      False      InstallState...
Motherboard resources              True      False      InstallState...
Motherboard resources              True      False      InstallState...
Motherboard resources              True      False      InstallState...
Realtek Asio Component             True      False      InstallState...

Since I cannot repro the case right now, let's brainstorm:

TobiasPSP commented 6 months ago

I ran the commands as non-elevated user BTW. Admin privs are not required.

BertV1 commented 6 months ago

@TobiasPSP Thanks for the confirmation that it should work. Tbh i'm perplexed because get-driver works. For the record, I've only reinstalled the package in the same way I previously did:

install-module -name devicemanagement -verbose
import-module -name devicemanagement -verbose

I did not reboot my pc (not that it would logically matter, but i want to accentuate how the state of my system did not change).

Get-Device still produces the same error. I'm currently running this on a win 10 pro 22h2

BertV1 commented 6 months ago

Is there maybe a specific device that you have installed that may wreck havoc?

Not that I am aware of, hèh. Everything should work as expected (if you want i could post devcon output in a PM, but i believe everything is OK)