Powershell Script to Export all Devices in Device Manager as tree or list?

Solution 1:

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:

  • https://gallery.technet.microsoft.com/Device-Management-7fad2388
  • http://blogs.technet.com/b/wincat/archive/2012/09/06/device-management-powershell-cmdlets-sample-an-introduction.aspx

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

Solution 2:

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