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
Thanks for sharing… Any suggestions (books/websites/videos) on learning Powershell, it seems very powerful.
LikeLike
Hi Paul, yes there’s loads. Click on the powershell tag above. I’m adding new stuff and links all the time so check back in from time to time.
LikeLike
Andrew
thanks for sharing. I always enjoy reading your blog. A lot of good stuff. Keep sharing your knowledge.
Jorge
LikeLike
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.
LikeLike
Hi there,
I’ve added a usage section above for beginners like yourself. Also, you should read this Technet article: http://technet.microsoft.com/en-gb/library/ee176949.aspx
/Andrew.
LikeLike
Hi,
Thanks and excellent tool though how and where can I add in Models under the Makes?
LikeLike
You create the Models manually. I didn’t want to over complicate the script.
LikeLike
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?
LikeLike
Using my import driver script, the script will import newly detected folders and ignore stuff that’s already there.
/Andrew
LikeLike
Sweeeet, I wasn’t sure if it did that. Thanks man, you rule.
LikeLike