Is there a script to import drivers into "Out-of-Box Drivers", as well as the folders' hierarchy by which the drivers stored.
-
Wednesday, October 31, 2012 1:51 PM
For example, a mass of drivers is stored in a folder named "Drivers". But they are not directly stored in the "Drivers" folder root. In the folder "Drivers" , there are many sub-folders, and in the sub folders there are many sub-sub folders...drivers is actually stored in these sub folders, for the need of classification management.
Now I want to import all the drivers into Out-of-Box node, and the hierarchy of the root folder and the sub folders must be the same as in Out-of-Box node.
How to?
- Edited by Long Bo Wednesday, October 31, 2012 1:57 PM
- Edited by Long Bo Wednesday, October 31, 2012 2:00 PM
- Edited by Long Bo Wednesday, October 31, 2012 2:01 PM
- Edited by Long Bo Wednesday, October 31, 2012 2:25 PM
- Edited by Long Bo Wednesday, October 31, 2012 2:28 PM
- Edited by Long Bo Thursday, November 01, 2012 3:37 AM
All Replies
-
Wednesday, October 31, 2012 1:54 PM
Johan has a good blog post about this exact scenario and includes a powershell script to do it for you.
http://www.deployvista.com/Blog/JohanArwidmark/tabid/78/EntryID/164/language/en-US/Default.aspx
- Proposed As Answer by Tim.Harris Wednesday, October 31, 2012 3:58 PM
- Marked As Answer by Long Bo Tuesday, November 06, 2012 1:55 PM
-
Wednesday, October 31, 2012 2:14 PM
Johan has a good blog post about this exact scenario and includes a powershell script to do it for you.
http://www.deployvista.com/Blog/JohanArwidmark/tabid/78/EntryID/164/language/en-US/Default.aspx
I have read the blog:
It said :
You need to edit the following information in the script to reflect your
environment$DriverStore = "C:\Drivers"
$MDTDSRoot = "C:\MDTBuildLab"
$PSDriveName = "DS001"I know $DriverStore = "C:\Drivers" and $MDTDSRoot = "C:\MDTBuildLab" , But what is $PSDriveName = "DS001", and how can I edit $PSDriveName = to reflect my environment?
-
Wednesday, October 31, 2012 2:20 PM
$DriverStore = "C:\Drivers" $MDTDSRoot = "C:\MDTBuildLab" $PSDriveName = "DS001" Add-PSSnapIn Microsoft.BDD.PSSnapIn New-PSDrive -Name "$PSDriveName" -PSProvider MDTProvider -Root $MDTDSRoot # Proces each of the operating systems folders Get-ChildItem "$DriverStore" | foreach { # Display the folder we are processing Write-Host "Processing $($_.FullName)" -ForeGroundColor green;Write-Host "" # Create the operating system folder in the MDT 2010 Deployment Workbench new-item -path $PSDriveName":\Out-of-Box Drivers" -enable "True" -Name "$($_.Name)" -ItemType "folder" -Verbose # Process each of the vendor folders $OSFolder = $_ Get-ChildItem $_.FullName | foreach { # Display the folder we are processing Write-Host "Processing $($_.FullName)" -ForeGroundColor green;Write-Host "" # Create the vendor folder in the MDT 2010 Deployment Workbench new-item -path $PSDriveName":\Out-of-Box Drivers\$OSFolder" -enable "True" -Name "$($_.Name)" -ItemType "folder" -Verbose # Process each of the model folders $VendorFolder = $_ Get-ChildItem $_.FullName | foreach { # Display the folder we are processing Write-Host "";Write-Host "Processing $($_.FullName)" -ForeGroundColor green;Write-Host "" # Create the model folder in the MDT 2010 Deployment Workbench new-item -path $PSDriveName":\Out-of-Box Drivers\$OSFolder\$VendorFolder" -enable "True" -Name "$($_.Name)" -ItemType "folder" -Verbose # Import the drivers into MDT 2010 Deployment Workbench Import-MDTDriver -Path $PSDriveName":\Out-of-Box Drivers\$OSFolder\$VendorFolder\$($_.Name)" -SourcePath "$($_.FullName)" -Verbose } } }- Proposed As Answer by Tim.Harris Wednesday, October 31, 2012 3:58 PM
- Marked As Answer by Long Bo Tuesday, November 06, 2012 1:55 PM
-
Wednesday, October 31, 2012 2:30 PM
Johan has a good blog post about this exact scenario and includes a powershell script to do it for you.
http://www.deployvista.com/Blog/JohanArwidmark/tabid/78/EntryID/164/language/en-US/Default.aspx
I have read the blog:
It said :
You need to edit the following information in the script to reflect your
environment$DriverStore = "C:\Drivers"
$MDTDSRoot = "C:\MDTBuildLab"
$PSDriveName = "DS001"I know $DriverStore = "C:\Drivers" and $MDTDSRoot = "C:\MDTBuildLab" , But what is $PSDriveName = "DS001", and how can I edit $PSDriveName = to reflect my environment?
Import-Module "C:\Program Files\Microsoft Deployment Toolkit\Bin\MicrosoftDeploymentToolkit.psd1"
Get-MDTPersistentDrive
This will give you a listing of your deployment shares.
- Edited by Tim.Harris Wednesday, October 31, 2012 2:30 PM
- Proposed As Answer by Tim.Harris Wednesday, October 31, 2012 3:58 PM
-
Wednesday, October 31, 2012 2:35 PM
Try this...
Open Powershell on the MDT server and type...
Add-PSSnapin Microsoft.BDD.PSSnapin <Enter>
Get-MDTPersistentDrive <Enter>
Look under the "Name" Column. That will show you something like DS001 or DS003.
Regards, Vik Singh "If this thread answered your question, please click on "Mark as Answer"
- Proposed As Answer by Tim.Harris Wednesday, October 31, 2012 3:58 PM
-
Thursday, November 01, 2012 2:25 PM
Shame that you can't read my blog in your country. MDT Powershell: Importing device drivers from organised folders
My script improves on the others out there as if you add a driver to your folder (or delete a driver from the store) and re-run the script it will test and re-add that driver.
I'll post the code in the script repository in a few hours, just have to go out now.
Blog: http://scriptimus.wordpress.com
-
Thursday, November 01, 2012 2:27 PM
I've also made a script to create the driver store for you:
MDT Powershell: Creating a Driverstore folder structure
Blog: http://scriptimus.wordpress.com
-
Thursday, November 01, 2012 6:23 PM
Alright, uploaded my driver import script here http://gallery.technet.microsoft.com/scriptcenter/Import-MDT-Drivers-from-91bc52a9
and the create driverstore script here: http://gallery.technet.microsoft.com/scriptcenter/Create-an-MDT-Driverstore-40b0a3c3
/Andrew.
Blog: http://scriptimus.wordpress.com
- Marked As Answer by Long Bo Tuesday, November 06, 2012 7:13 AM
-
Friday, November 02, 2012 2:13 AM
Hi andrew, how great you are!
Create-DriverStore.ps1 is only intended to be used to create empty folders in the Out-of-Box node with the same structure of driver files storage folder?
And Import-MDTDrivers.ps1 is intended to create folder according to the structure of driver files storage folder and import drivers? right?
Later I will do a test.
I found that , the script Tim.Harris offered with the help of http://www.deployvista.com can only create the 3rd level folders into the Out-of-Box Drivers node according to the structure of drivers files storage folder, although the structure of drivers files storage folder has more than 3 levels.
For example , the structure of drivers files storage folder is Drivers for OSD(root)/Driverpack.net/Vista.7_x86/Touchpad_Mouse/3/M/(OEM name folders)/actual drivers.
But with the script from http://www.deployvista.com, the folder level created into Out-of-Box Drivers is only the level of "Touchpad_Mouse", and in Touchpad_Mouse folder is the actual drivers files... The structure of "/3/M/(OEM name folders)/actual drivers" was lost.
I do not know if I describ it clearly ,but I think you can understand.
-
Friday, November 02, 2012 5:34 AM
Import-MDTDrivers.ps1.
I don't know what's wrong.
I copied Import-MDTDrivers.ps1 into the driverstore folder "D:\Drivers for OSD\WanDrv.com" which I wanted to import drivers from.
Then I mapped to the path in PowerShell window. When I typied "Import-MDTDrivers.ps1[enter]", it looked like Import-MDTDrivers.ps1 could not be recoginized by the powershell .
Then I copied all codes from Import-MDTDrivers.ps1 and pasted it into the powershell windows. Error came out like below.
-
Friday, November 02, 2012 8:12 AM
You have to type .\Import-MDTDrivers.ps1 Powershell needs the .\ as the exact path to the script.
I suspect you may run into further issues also. It appears that you've never run a PowerShell script. Before you run the script, do this below.
- Type Set-ExecutionPolicy if the console returns "Restricted" then you will need to perform step 4.
- In an elevated PowerShell console(run as Administrator) type Set-ExecutionPolicy RemoteSigned
Blog: http://scriptimus.wordpress.com
-
Friday, November 02, 2012 8:16 AM
Hi andrew, how great you are!
Create-DriverStore.ps1 is only intended to be used to create empty folders in the Out-of-Box node with the same structure of driver files storage folder?
No, this script will create the folders on your hard drive based on the makes and models that you intend to use.

Blog: http://scriptimus.wordpress.com
-
Friday, November 02, 2012 9:02 AM
Yes, I am very new in Power Shell.
Can you make your .ps1 file easy to run for the newbies as me :-)
or Please teach me with the way in detail :-)
Thx!
-
Friday, November 02, 2012 9:11 AM
Yes, I am very new in Power Shell.
Can you make your .ps1 file easy to run for the newbies as me :-)
or Please teach me with the way in detail :-)
Thx!
Indeed.
First, prepare PowerShell so that it can run scripts. Video here. Or do this:
- Type Set-ExecutionPolicy if the console returns "Restricted" then you will need to perform step 2.
- In an elevated PowerShell console(run as Administrator) type Set-ExecutionPolicy RemoteSigned
Next, navigate to the drivers folder as you did before. Then do this:
Type .\Import-MDTDrivers.ps1
\Andrew
Blog: http://scriptimus.wordpress.com
-
Saturday, November 03, 2012 10:04 AMI had set the Set-ExecutionPolicy Unrestricted, but the ps1 could not run correctly with many warning words in red color.
-
Saturday, November 03, 2012 6:23 PMcan you post you latest errors?
-
Monday, November 05, 2012 7:15 AM
安全警告 请只运行您信任的脚本。虽然来自 Internet 的脚本会有一定的用处,但此脚本可能会损坏您的计算机。是否要运行 D:\Drivers for OSD\Import-MDTDrivers.ps1? [D] 不运行(D) [R] 运行一次(R) [S] 挂起(S) [?] 帮助 (默认值为“D”): r 无法对类型为 Microsoft.BDD.PSSnapIn.MDTDriveSettings 的对象进行索引。 所在位置 D:\Drivers for OSD\Import-MDTDrivers.ps1:35 字符: 61 + IF (!$PSDriveName) {$PSDriveName = (Get-MDTPersistentDrive)[ <<<< 0].name} + CategoryInfo : InvalidOperation: (0:Int32) [], RuntimeException + FullyQualifiedErrorId : CannotIndex 无法对类型为 Microsoft.BDD.PSSnapIn.MDTDriveSettings 的对象进行索引。 所在位置 D:\Drivers for OSD\Import-MDTDrivers.ps1:38 字符: 69 + IF (!$DeploymentShare) {$DeploymentShare = (Get-MDTPersistentDrive)[ <<<< 0].path} + CategoryInfo : InvalidOperation: (0:Int32) [], RuntimeException + FullyQualifiedErrorId : CannotIndex Get-PSDrive : 未将对象引用设置到对象的实例。 所在位置 D:\Drivers for OSD\Import-MDTDrivers.ps1:44 字符: 18 + If (!(Get-PSDrive <<<< -Name $PSDriveName -ErrorAction SilentlyContinue)) { + CategoryInfo : NotSpecified: (:) [Get-PSDrive], NullReferenceException + FullyQualifiedErrorId : System.NullReferenceException,Microsoft.PowerShell.Commands.GetPSDriveCommand Test-Path : 不支持给定路径的格式。 所在位置 D:\Drivers for OSD\Import-MDTDrivers.ps1:50 字符: 20 + if (!(Test-Path <<<< $DSDriverPath\$OS)) { + CategoryInfo : InvalidOperation: (D:\Drivers for ...DriverPacks.net:String) [Test-Path], NotSupportedEx ception + FullyQualifiedErrorId : ItemExistsNotSupportedError,Microsoft.PowerShell.Commands.TestPathCommand New-Item : 找不到与参数名称“enable”匹配的参数。 所在位置 D:\Drivers for OSD\Import-MDTDrivers.ps1:51 字符: 45 + new-item -path $DSDriverPath -enable <<<< "True" -Name $OS -ItemType "folder" -Verbose + CategoryInfo : InvalidArgument: (:) [New-Item], ParameterBindingException + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.NewItemCommand Test-Path : 不支持给定路径的格式。 所在位置 D:\Drivers for OSD\Import-MDTDrivers.ps1:54 字符: 20 + if (!(Test-Path <<<< $DSSelectionProfilePath"\Drivers - "$OS)) { + CategoryInfo : InvalidOperation: (D:\Drivers for ...DriverPacks.net:String) [Test-Path], NotSupportedEx ception + FullyQualifiedErrorId : ItemExistsNotSupportedError,Microsoft.PowerShell.Commands.TestPathCommand New-Item : 找不到与参数名称“enable”匹配的参数。 所在位置 D:\Drivers for OSD\Import-MDTDrivers.ps1:55 字符: 55 + new-item -path $DSSelectionProfilePath -enable <<<< "True" -Name "Drivers - $OS" -Definition "<SelectionProf ile><Include path=`"Out-of-Box Drivers\$OS`" /></SelectionProfile>" -ReadOnly "False" -Verbose + CategoryInfo : InvalidArgument: (:) [New-Item], ParameterBindingException + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.NewItemCommand Test-Path : 不支持给定路径的格式。 所在位置 D:\Drivers for OSD\Import-MDTDrivers.ps1:60 字符: 24 + if (!(Test-Path <<<< $DSDriverPath\$OS\$Make)) { + CategoryInfo : InvalidOperation: (D:\Drivers for ...ks.net\Win7_x64:String) [Test-Path], NotSupportedEx ception + FullyQualifiedErrorId : ItemExistsNotSupportedError,Microsoft.PowerShell.Commands.TestPathCommand New-Item : 找不到与参数名称“enable”匹配的参数。 所在位置 D:\Drivers for OSD\Import-MDTDrivers.ps1:61 字符: 53 + new-item -path $DSDriverPath\$OS -enable <<<< "True" -Name $Make -ItemType "folder" -Verbose + CategoryInfo : InvalidArgument: (:) [New-Item], ParameterBindingException + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.NewItemCommand Test-Path : 不支持给定路径的格式。 所在位置 D:\Drivers for OSD\Import-MDTDrivers.ps1:65 字符: 28 + if (!(Test-Path <<<< $DSDriverPath\$OS\$Make\$Model)) { + CategoryInfo : InvalidOperation: (D:\Drivers for ...7_x64\AMDFilter:String) [Test-Path], NotSupportedEx ception + FullyQualifiedErrorId : ItemExistsNotSupportedError,Microsoft.PowerShell.Commands.TestPathCommand New-Item : 找不到与参数名称“enable”匹配的参数。 所在位置 D:\Drivers for OSD\Import-MDTDrivers.ps1:66 字符: 63 + new-item -path $DSDriverPath\$OS\$Make -enable <<<< "True" -Name $Model -ItemType "folder" -Verbose + CategoryInfo : InvalidArgument: (:) [New-Item], ParameterBindingException + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.NewItemCommand Import-MDTDriver : 无法将参数“Path”绑定到目标。设置“Path”时发生异常:“找不到路径“D:\Drivers for OSD\:\Out-of-Box D rivers\DriverPacks.net\Win7_x64\AMDFilter”,因为该路径不存在。” 所在位置 D:\Drivers for OSD\Import-MDTDrivers.ps1:67 字符: 39 + import-mdtdriver -path <<<< $DSDriverPath\$OS\$Make\$Model -SourcePath $_.FullName -Verbose + CategoryInfo : WriteError: (:) [Import-MDTDriver], ParameterBindingException + FullyQualifiedErrorId : ParameterBindingFailed,Microsoft.BDD.PSSnapIn.ImportDriver Test-Path : 不支持给定路径的格式。 所在位置 D:\Drivers for OSD\Import-MDTDrivers.ps1:65 字符: 28 + if (!(Test-Path <<<< $DSDriverPath\$OS\$Make\$Model)) { + CategoryInfo : InvalidOperation: (D:\Drivers for ...\Win7_x64\Audio:String) [Test-Path], NotSupportedEx ception + FullyQualifiedErrorId : ItemExistsNotSupportedError,Microsoft.PowerShell.Commands.TestPathCommand New-Item : 找不到与参数名称“enable”匹配的参数。 所在位置 D:\Drivers for OSD\Import-MDTDrivers.ps1:66 字符: 63 + new-item -path $DSDriverPath\$OS\$Make -enable <<<< "True" -Name $Model -ItemType "folder" -Verbose + CategoryInfo : InvalidArgument: (:) [New-Item], ParameterBindingException + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.NewItemCommand Import-MDTDriver : 无法将参数“Path”绑定到目标。设置“Path”时发生异常:“找不到路径“D:\Drivers for OSD\:\Out-of-Box D rivers\DriverPacks.net\Win7_x64\Audio”,因为该路径不存在。” 所在位置 D:\Drivers for OSD\Import-MDTDrivers.ps1:67 字符: 39 + import-mdtdriver -path <<<< $DSDriverPath\$OS\$Make\$Model -SourcePath $_.FullName -Verbose + CategoryInfo : WriteError: (:) [Import-MDTDriver], ParameterBindingException + FullyQualifiedErrorId : ParameterBindingFailed,Microsoft.BDD.PSSnapIn.ImportDriver Test-Path : 不支持给定路径的格式。 所在位置 D:\Drivers for OSD\Import-MDTDrivers.ps1:65 字符: 28 + if (!(Test-Path <<<< $DSDriverPath\$OS\$Make\$Model)) { + CategoryInfo : InvalidOperation: (D:\Drivers for ...7_x64\Bluetooth:String) [Test-Path], NotSupportedEx ception + FullyQualifiedErrorId : ItemExistsNotSupportedError,Microsoft.PowerShell.Commands.TestPathCommand New-Item : 找不到与参数名称“enable”匹配的参数。 所在位置 D:\Drivers for OSD\Import-MDTDrivers.ps1:66 字符: 63 + new-item -path $DSDriverPath\$OS\$Make -enable <<<< "True" -Name $Model -ItemType "folder" -Verbose + CategoryInfo : InvalidArgument: (:) [New-Item], ParameterBindingException + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.NewItemCommand Import-MDTDriver : 无法将参数“Path”绑定到目标。设置“Path”时发生异常:“找不到路径“D:\Drivers for OSD\:\Out-of-Box D rivers\DriverPacks.net\Win7_x64\Bluetooth”,因为该路径不存在。” 所在位置 D:\Drivers for OSD\Import-MDTDrivers.ps1:67 字符: 39 + import-mdtdriver -path <<<< $DSDriverPath\$OS\$Make\$Model -SourcePath $_.FullName -Verbose + CategoryInfo : WriteError: (:) [Import-MDTDriver], ParameterBindingException + FullyQualifiedErrorId : ParameterBindingFailed,Microsoft.BDD.PSSnapIn.ImportDriver
- Edited by Long Bo Monday, November 05, 2012 7:16 AM
-
Monday, November 05, 2012 7:17 AM
- Edited by Long Bo Monday, November 05, 2012 7:18 AM
-
Monday, November 05, 2012 7:20 AM
-
Monday, November 05, 2012 1:28 PM
Doesn't matter where you put the .ps1 file. Seems you run this without the necessary parameters.
Try edit this .ps1 file with Windows Powershell ISE. Read line 16. It's a good example of what to do:
Import-MDTDrivers.ps1 -DriverPath C:\Downloads\Drivers -PSDriveName DS001 -DeploymentShare D:\DeploymentShare
- Marked As Answer by Long Bo Tuesday, November 06, 2012 7:13 AM

