List Drivers Details from a ConfigMgr Boot Image

Here is a quick PowerShell script that lists driver details from a ConfigMgr Boot Image. The script works regardless of whether you have a matching ADK version.

# Specify Boot image to list drivers from
$BootImageName = "Boot image (x64)"

# Site configuration
$SiteCode = "PS1" # Site code 
$ProviderMachineName = "CM01.corp.viamonstra.com" # SMS Provider machine name

# Import the ConfigurationManager.psd1 module 
if((Get-Module ConfigurationManager) -eq $null) {
    Import-Module "$($ENV:SMS_ADMIN_UI_PATH)\..\ConfigurationManager.psd1" 
}

# Connect to the site's drive if it is not already present
if((Get-PSDrive -Name $SiteCode -PSProvider CMSite -ErrorAction SilentlyContinue) -eq $null) {
    New-PSDrive -Name $SiteCode -PSProvider CMSite -Root $ProviderMachineName 
}

# Set the current location to be the site code.
Set-Location "$($SiteCode):\" 

# Get drivers added to boot image 
$BootImage = Get-CMBootImage -Name $BootImageName

# Validation
If (!($BootImage)){
    Write-Warning "Boot image not found"

}

# Get details from boot image
$BootImageID = $BootImage.PackageID
$BootImageDrivers = $BootImage.ReferencedDrivers

Write-Host "Working on boot image: $BootImageName with Package ID: $BootImageID"

foreach ($Driver in $BootImageDrivers){
    Set-Location "$($SiteCode):\" 
    $DriverDetails = Get-CMDriver -Id $Driver.ID -Fast
    Write-Host "Name: $($DriverDetails.LocalizedDisplayName)"
    Write-Host "SourcePath: $($DriverDetails.ContentSourcePath)"
    Write-Host "Inf File: $($DriverDetails.DriverINFFile)"
    Write-Host "Date: $($DriverDetails.DriverDate)"
    Write-Host "Version: $($DriverDetails.DriverVersion)"
    Write-Host "" 

    # Validate driver sources
    Set-Location C:
    $DriverFile = "$($DriverDetails.ContentSourcePath)\$($DriverDetails.DriverINFFile)"
    If (Test-Path $DriverFile){
        #"YAY"
    }
    Else {
        Write-Warning "Driver source not found... Not good"
    }

}
About the author

Johan Arwidmark

5 1 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted

>