Skip to content

Instantly share code, notes, and snippets.

@brianfgonzalez
Last active October 23, 2016 19:53
Show Gist options
  • Save brianfgonzalez/7bea284e2d6c52d2a83e8b67a80ac140 to your computer and use it in GitHub Desktop.
Save brianfgonzalez/7bea284e2d6c52d2a83e8b67a80ac140 to your computer and use it in GitHub Desktop.
#Script creates a Selection Profile for each folder under the MDT's "Out-of-Box Drivers" node.
$deployRoot = "D:\AiO"
Import-Module -Name "${env:ProgramFiles}\Microsoft Deployment Toolkit\bin\MicrosoftDeploymentToolkit.psd1"
New-PSDrive -Name 'SelectionProfileScript' -PSProvider MDTProvider -Root $deployRoot -Force
Get-ChildItem -Path 'SelectionProfileScript:\Out-Of-Box Drivers' -Recurse | `
Where-Object { $_.NodeType -eq 'DriverFolder' } | `
ForEach-Object {
#before: Out-Of-Box Drivers\10 x64\Panasonic\PDP_CF-53mk4_Win7x64_V2.00L11M00
#after: OoB-10x64-Panasonic-PDP_CF-53mk4_Win7x64_V2.00L11M00
$path = ($_.PSPath -replace 'MicrosoftDeploymentToolkit\\MDTProvider::SelectionProfileScript:\\', '')
$name = `
$path -replace 'Out-Of-Box Drivers', 'OoB' `
-replace '\\', '-' `
-replace ' ', ''
New-Item -Path 'SelectionProfileScript:\Selection Profiles' -Enable 'True' -Name $name -Comments '' `
-Definition ('<SelectionProfile><Include path="'+$path+'" /></SelectionProfile>') `
-ReadOnly 'False' -Verbose
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment