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