Importing Drivers and creating Driver Packages using PowerShell
By William Bracken
Published September 10, 2014
Estimated Reading Time: 4 minutes

Anyone who manages drivers and driver packages for System Center Configuration Manager 2012 OS Deployment likely agrees that using the Admin GUI for importing drivers and creating driver packages can be a very time consuming process.  Multiply that by number of OS’s, Architecture types and computer models you support and that can add up to a lot of lost productivity.


Thanks to the (new to 2102) PowerShell cmdlets you can dramatically reduce the amount of time it takes to import drivers and create driver packages for your hardware models.  Using the sample script (below) with these basic steps you will have you powering through drivers and driver packages in no time.

  1. Download the driver sets from the manufacturers website.  OEM’s like Dell provide a CAB file download that contains a full set of plug and play ready drivers that can be quickly extracted in one fell swoop.  In many cases these “driver packs” contain both x86 and x64 full driver sets.  Be sure to remove one or the other if not needed or at the very least, separate them out into their own folder structure.
    Note: These CAB files can get out of date as they are not updated as frequently as the individual driver packages.  You should check to see if there are any updated drivers that may need to be downloaded individually to replace the file provided in the CAB.
  2. Once the drivers are extracted and plug and play ready, copy them to the source “Driver” UNC share directory where they will be imported from.
  3. Using the example script below, modify the script variables to reflect the Model, OS, Architecture, source Driver path (from step 2), and the destination source directory for the Driver Package that will be created.
  4. From a computer with an SCCM 2012 Admin Console installed, open an elevated PowerShell window (using credentials that have permissions to manage drivers and driver packages) and execute the script.
  5. The result should be a fully imported set of drivers (with assigned category for ease of management) and a new driver package containing all the imported drivers.  No boring dialogs to contend with and you remove much of the human element that can compromise standards.

An Important side note about Version 1 of driver packages:  In all my years of managing drivers/driver packages, “Version 1” of a driver package on Distribution Points (i.e. the first time the package is assigned to a DP or DP Group) is always incomplete and causes the Task Sequence to fail.  I can’t say its a global issue for everyone, however I have experienced this issue in EVERY SCCM implementation I have ever done…ever.  I have also reached out to other SCCM Admins and have heard the same story.  Unfortunately this issue tends to send newer SCCM Admins into a troubleshooting frenzy when their Task Sequence fails.

The easy workaround to this issue is to run an “Update Distribution Point” at least once after the package has been assigned to one or more DP’s.  This will increment the version of the package to Version 2 and all driver content will be distributed properly.


The example script below makes a few assumptions (that you can easily modify to reflect your own standards) such as:

  • You use the “Apply Driver Package” step in your Task Sequence (the one to one driver package methodology)
  • Your naming convention for your driver packages is: Manufacturer Model OS OSArchitecture.
    Example: Dell Optiplex 7010 Win7 x64
  • Your category name for the drivers matches your package name.
  • You append the category to an existing driver.
  • You do not want to automatically deploy the package to your Distribution Points/Groups

You could of course incorporate command line options that you could simply pass to the script for setting the model, os, etc. as well as a parameter to assign to one or more DP/DP groups as part of the process.

Click here for the SCCM 2012 R2 cmdlet reference TechNet page.


Example Script:


#Import Drivers and Create Driver Package – SCCM 2012


# Set variables

#== Example: “Dell Optiplex 7010” or “Dell Latitude E6540”
$Model = “Dell Latitude E6440”

#== Example: “Win7” or “Win8”
$DriverOS = “Win7”

#== Options are “x86” or “x64”
$DriverArchitecture = “x64”

#== Driver root source dir
$DriverRootSource = “\\server\share\OSD\Drivers”
$DriverPkgRootSource = “\\server\share\OSD\DriverPackages”

# Begin

#Put together variables based on model, os, and architecture
$DriverPackageName = $Model + ” ” + $DriverOS + ” ” + $DriverArchitecture
$DriverSource = $DriverRootSource + “\” + $DriverOS + $DriverArchitecture + “\” + $Model
$DriverPkgSource = $DriverPkgRootSource + “\” + $DriverOS + $DriverArchitecture + “\” + $Model
# Verify Driver Source exists.
Write-Host “Checking for ” $DriverSource
If (Get-Item $DriverSource -ErrorAction SilentlyContinue)
# Get driver files
$Drivers = Get-childitem -path $DriverSource -Recurse -Filter “*.inf”
Write-Warning “Driver Source not found. Cannot continue”

# Create Driver package source if not exists
If (Get-Item $DriverPkgSource -ErrorAction SilentlyContinue)
Write-Host “$DriverPkgSource already exists… ”
Write-Host “Creating Driver package source directory $DriverPkgSource”
New-Item -ItemType directory $DriverPkgSource

# Import SCCM module
Import-Module ‘C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1’
#Your site code here
If (Get-CMDriverPackage -Name $DriverPackageName)
Write-Warning “$DriverPackageName Already exists. Existing”
Write-Host “Creating new Driver Package: ” $DriverPackageName
New-CMDriverPackage -Name “$DriverPackageName” -Path “$DriverPkgSource” -PackageSourceType StorageDirect

$DriverPackage = Get-CMDriverPackage -Name $DriverPackageName
New-CMCategory -CategoryType DriverCategories -Name $DriverPackageName -ErrorAction SilentlyContinue
$DriverCategory = Get-CMCategory -Name $DriverPackageName

foreach($item in $Drivers)
$DriverPackage = Get-CMDriverPackage -Name $DriverPackageName
Import-CMDriver -UncFileLocation $item.FullName -ImportDuplicateDriverOption AppendCategory -EnableAndAllowInstall $True -DriverPackage $DriverPackage -AdministrativeCategory $DriverCategory -UpdateDistributionPointsforDriverPackage $False



Post Tags:
Article By William Bracken
Partner – Model Technology Solutions William is an experienced and results-driven IT geek who is passionate about the “automation of things,” with an extensive background in systems management, advanced OS deployment automation, and overall infrastructure automation. He has more than 19 years of experience in IT, and has designed and implemented management solutions that have dramatically reduced support costs and ultimately brought consistent and well managed operating environments to organizations across the US.

Related Posts