MDT Powershell: Creating a Driverstore folder structure

I was thinking about my drivers folder and helping people to organise their drivers and I remembered Chris Nackers and Johan Arwidmark had posted scripts to help import drivers into MDT.

I’ve created a script that can be used to generate a driver repository folder structure on a hard drive or network share. The structure is in a format useful to MDT and SCCM.

This screenshot shows a recommended tree structure for organising your drivers.

The structure allows you to separate architecture, OS and models in order to organise drivers and better leverage Selection Profiles within MDT. Another tip is to use the exact make and model descriptions from WMI so you can use variables to target your driver selection.

Thanks to Andy Sibthorp for spotting an obvious flaw in the original code. Here’s my script:

Param(
    $Folder="C:\Downloads\Drivers",
    $archs = "x86","x64",
    $OSs = "Windows PE","Windows XP","Windows 7","Windows 8",
$Makes = "Dell Inc.","Hewlett-Packard","Microsoft Corporation","VMware, Inc"
)

foreach ($arch in $archs) {
    foreach ($OS in $OSs) {
        foreach ($make in $Makes) {
            New-Item -path "$Folder\$OS $arch" -Name "$Make" -Type directory
            }
        }
    }

There are 4 Variables that can be edited to include/exclude OS or Models etc.

The full code is below and in the script repository here.

<#
.SYNOPSIS
Create a Driver Repository for SCCM and MDT drivers.

.DESCRIPTION
The Create-DriverStore.ps1 script will create a folder then populate it with empty subfolders suitable for driver storage.

.PARAMETER Folder
Specifies the path where the folder structure will be created.

.PARAMETER archs
List the architecture(s) that you will be deploying to

.PARAMETER OSs
List the Operating Systems that you will be deploying within your Enterprise

.PARAMETER Makes
List all the Manufacturers of Computers within your organisation

.EXAMPLE
Create-DriverStore.ps1
This will create a New Driver repository in the default recomended location

.EXAMPLE
Create-DriverStore.ps1 -Folder C:\DriverStore
This will create a New Driver repository in C:\DriverStore

.EXAMPLE
Create-DriverStore.ps1 -Folder C:\Downloads\Drivers -archs x86 -OSs "Windows PE","Windows 8" -Makes "Dell Inc.", "VMWare"
This will create a New Driver repository in C:\Downloads\Drivers for x86 Architecture for Windows PE and Windows 8 for models Dell and VMware

.NOTES
Author: Andrew Barnes
Date: 4 June 2012

Version Control:
16 November 2012 - Fixed parameter block

.LINK
Online version: https://scriptimus.wordpress.com
#>

Param (
[String[]]$Folder=("C:\Downloads\Drivers"),
[String[]]$archs = ("x86","x64"),
[String[]]$OSs = ("Windows PE","Windows XP","Windows 7"),
[String[]]$Makes = ("Dell Inc.","Hewlett-Packard","Microsoft Corporation","VMware, Inc")
)

Begin{}
Process{
foreach ($arch in $archs) {
foreach ($OS in $OSs) {
foreach ($make in $Makes) {
New-Item -path "$Folder\$OS $arch" -Name "$Make" -Type directory
}
}
}
}
End{}

My next post will contain my script for importing drivers from this store into MDT. Enjoy.

 

The script is self documenting, open a Powershell Console and type:


Get-Help .\Create-DriverStore.ps1 -Examples

This will show the usage examples like below.

————————– EXAMPLE 1 ————————–

C:\PS>Create-DriverStore.ps1

This will create a New Driver repository in the default recomended location

————————– EXAMPLE 2 ————————–

C:\PS>Create-DriverStore.ps1 -Folder C:\DriverStore

This will create a New Driver repository in C:\DriverStore

————————– EXAMPLE 3 ————————–

C:\PS>Create-DriverStore.ps1 -Folder C:\Downloads\Drivers -archs x86 -OSs “Windows PE”,”Windows 8″ -Makes “Dell Inc.”, “VMWare”

This will create a New Driver repository in C:\Downloads\Drivers for x86 Architecture for Windows PE and Windows 8 for models Dell and VMware

 

About Andrew Barnes

A Scripting and Deployment Specialist.
This entry was posted in Deployment, MDT 2010, MDT 2012, PowerShell, SCCM and tagged , , , . Bookmark the permalink.

10 Responses to MDT Powershell: Creating a Driverstore folder structure

  1. Paul Griffith says:

    Thanks for sharing… Any suggestions (books/websites/videos) on learning Powershell, it seems very powerful.

    Like

  2. Jorge says:

    Andrew
    thanks for sharing. I always enjoy reading your blog. A lot of good stuff. Keep sharing your knowledge.
    Jorge

    Like

  3. Fid says:

    Please forgive my ignorance as this is my first time setting up a deployment server, can you explain how you run the script with powershell. I have tried clicking on the script and ran with powershell, but it did not do anything.

    Like

  4. Marshall says:

    Hi,
    Thanks and excellent tool though how and where can I add in Models under the Makes?

    Like

  5. Hey Andrew,

    Awesome work, love your stuff. Quick question though. I’ve already set up my driver store as you’ve described, but let’s say I get a few new models of PC and want to add their drivers after the fact. How would I go about doing that so that it stays nice and organized?

    Like

Leave a comment