9

With former Windows versions, it was possible to print the information from the Device Manager, but it does not seem possible to do this with Windows 7 any longer.

I am looking for a Powershell script that exports all devices that also appear in Device Manager to a text file, and optionally creating it in a tree-like Device Manager type of view if possible.

This would be so helpful in many cases, but I haven't found anything like this from what research I've done.

0

3 Answers 3

2

Powershell Script to export all Devices in Device Manager

I am looking for a Powershell script that exports all devices that also appear in Device Manager to a text file, and optionally creating it in a tree-like Device Manager type of view if possible.

I just tested this with Windows 7 and it seems to work just fine from what I could tell, so here's a PowerShell module you can import and then use to get the device detail you need plus some.

An example syntax below as well to put to a text file which you requested. Just plug in your syntax and then put the | Out-File -Append -Force "C:\path\FileListName.txt" command to the end of it with your file location to put in a text file for later review (http://ss64.com/ps/out-file.html).

EXAMPLE

Get-Device | Sort-Object -Property Name | ft Name, DriverVersion, DriverProvider, IsPresent, HasProblem -AutoSize | Out-File -Append -Force "C:\path\FileListName.txt"

Import-Module Note

If you have trouble with the import, just download the ZIP file, extract or copy the Release folder from within it to your desktop temporarily, and then use the explicit path import syntax to point to the psd1 file: Import-Module C:\Users\<username>\Desktop\Release\DeviceManagement.psd1 –Verbose


Source Links:

Downloading and using the Device Management PowerShell Cmdlets

The Device Management PowerShell cmdlets are available at: http://gallery.technet.microsoft.com/Device-Management-7fad2388

To download, follow the above link and click on the “Download” button. Save and extract the contents of the.zip file to a folder of your choice.

The next step is to import the module and start using the cmdlets! In order to do so, launch an instance of PowerShell and follow the below steps:

Importing the Cmdlet module:

Import-Module .\PSCmdlet.psd1 –Verbose

Listing Devices

All devices present on the system

Get-Device | Sort-Object -Property Name | ft Name, DriverVersion, DriverProvider, IsPresent, HasProblem -AutoSize

“Hidden” devices

Get-Device -ControlOptions DIGCF_ALLCLASSES | Sort-Object -Property Name | Where-Object -Property IsPresent -eq $false | ft Name, DriverVersion, DriverProvider, IsPresent, HasProblem -AutoSize

Disabled devices

Get-Device | Sort-Object -Property Name | Where-Object -Property ConfigurationFlags -Like 'DISABLED' | ft Name, InstanceId -AutoSize

3
  • Note, that according to the article Get-Device requires Windows Server 2012 or Windows 8 and OP is using Windows 7. I wish that I could trust specs without testing them. Dec 23, 2015 at 14:43
  • 1
    I noticed that too; however, I tested and confirmed that it ALSO works with Windows 7 which I did indicate in my answer specifically. I did NOT post an answer until I tested and confirmed all worked as expected with Windows 7 as I usually do as a standard per the wording of the request for any or all parts of it to satisfy accordingly. Dec 23, 2015 at 14:48
  • Get-Device is not available in Windows 10? Tested as administrator in Windows Powershell and PowerShell (Core). Would also like to export driver versions and names Jul 2, 2020 at 9:48
7

You still can print/export from MsInfo32:

There is no such option to print the Device Manager Report in Windows 7 as we have it in Windows XP. However, you can try printing the Device Resources by getting into System Properties. Here is the step to get into System Properties.

Click on Start, type msinfo32 in the search box.

  1. On the System Properties window, it will list the below options.

    • Hardware Resources.
    • Components.
    • Software Environment.
    • Select the option which you want to print.

Now, select the File option from the Menu Bar, then click on Export and then give a file name and select it.

  1. Try opening the file and then print it.

Also you can list all devices with this PowerShell onliner (no tree, though):

Get-WmiObject Win32_PNPEntity | Select Name, DeviceID 

Example output:

Name                                                                                       DeviceID                                                                                 
----                                                                                       --------                                                                                 
Generic PnP Monitor                                                                        DISPLAY\NEC66C0\5&3A115792&2&UID257                                                      
Motherboard resources                                                                      ACPI\PNP0C02\1                                                                           
Motherboard resources                                                                      ACPI\PNP0C02\2                                                                           
Intel(R) processor DRAM Controller - 0044                                                  PCI\VEN_8086&DEV_0044&SUBSYS_1C771043&REV_18\3&11583659&0&00                             
Numeric data processor                                                                     ACPI\PNP0C04\4&142DD991&0                                                                
Microsoft ACPI-Compliant Control Method Battery                                            ACPI\PNP0C0A\0                                                                           
High Definition Audio Bus                                                                  PCI\VEN_1002&DEV_AA68&SUBSYS_AA681043&REV_00\4&179FD7D4&0&0108                           
Generic volume                                                                             STORAGE\VOLUME\{5200DD0F-4FFD-11E5-8381-806E6F6E6963}#0000001900100000                   
Root Print Queue                                                                           SWD\PRINTENUM\PRINTQUEUES                                                                
Volume Manager                                                                             ROOT\VOLMGR\0000                                                                         
Logicool USB (RX250) Optical Mouse                                                         USB\VID_046D&PID_C050\6&2582BEDF&0&2                                                     
Intel(R) 5 Series/3400 Series Chipset Family PCI Express Root Port 1 - 3B42                PCI\VEN_8086&DEV_3B42&SUBSYS_1C771043&REV_06\3&11583659&0&E0   
1
  • +1 for the Powershell command. You can do Invoke-Command -ComputerName hostname { Get-WmiObject Win32_PNPEntity | Select Name, DeviceID } to get a device list for a remote computer. Apr 19, 2017 at 1:30
3

Do this for Windows10:

Invoke-Command -ComputerName localhost { Get-WmiObject Win32_PNPEntity | Where { $_.PNPClass -notin  "System","Net","Processor","SoftwareDevice","AudioEndpoint","BluetoothVirtual","Battery","Media","Volume","Modem","Camera","VolumeSnapshot","DiskDrive","Computer","HIDClass"}} | Sort-Object -Property PNPClass | Format-Table Name, Manufacturer, PNPClass, Status

Complete list of properties: https://docs.microsoft.com/en-us/windows/desktop/cimwin32prov/win32-pnpentity

enter image description here

2
  • 1
    Why "Invoke-Command -ComputerName localhost"? Why not just calling Get-WmiObject directly? Dec 9, 2019 at 14:19
  • @MehrdadMirreza, thank you, I posted that in case someone wanted to target a remote machine Dec 9, 2019 at 21:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .