|
| 1 | +<# |
| 2 | + # This script exports drivers from the machine you are running on, stores them in a folder and create a .CSV file that can be used to |
| 3 | + # import custom driver package for the Modern Driver Managment tool. http://www.scconfigmgr.com/modern-driver-management/ |
| 4 | +#> |
| 5 | + |
| 6 | +Function Export-TSxWindowsDriver { |
| 7 | + Param( |
| 8 | + $Path, |
| 9 | + $Platform, |
| 10 | + $WindowsVersion, |
| 11 | + $Architecture, |
| 12 | + $Version |
| 13 | + ) |
| 14 | + #ExportDriver |
| 15 | + $Make = (Get-WmiObject -Class Win32_Computersystem).Manufacturer |
| 16 | + switch ($Make) |
| 17 | + { |
| 18 | + 'HP'{ |
| 19 | + $MakeAlias='Hewlett-Packard' |
| 20 | + $ModelAlias = (Get-WmiObject -Class Win32_ComputerSystem).model |
| 21 | + $BaseBoard = (Get-CIMInstance -ClassName MS_SystemInformation -NameSpace root\WMI).BaseBoardProduct |
| 22 | + } |
| 23 | + |
| 24 | + 'Hewlett-Packard'{ |
| 25 | + $MakeAlias=$Make |
| 26 | + $ModelAlias = (Get-WmiObject -Class Win32_ComputerSystem).model |
| 27 | + $BaseBoard = (Get-CIMInstance -ClassName MS_SystemInformation -NameSpace root\WMI).BaseBoardProduct |
| 28 | + } |
| 29 | + |
| 30 | + 'LENOVO'{ |
| 31 | + $MakeAlias=$Make |
| 32 | + $ModelAlias = (Get-WmiObject -Class Win32_ComputerSystemProduct).version |
| 33 | + $BaseBoard = ((Get-WmiObject -Class Win32_ComputerSystem | Select-Object -ExpandProperty Model).SubString(0, 4)).Trim() |
| 34 | + } |
| 35 | + |
| 36 | + 'Microsoft Corporation'{ |
| 37 | + $MakeAlias='Microsoft' |
| 38 | + $ModelAlias = (Get-WmiObject -Class Win32_ComputerSystem).model |
| 39 | + $BaseBoard = (Get-WmiObject -Class Win32_ComputerSystem).model |
| 40 | + } |
| 41 | + Default {} |
| 42 | + } |
| 43 | + |
| 44 | + New-Item -Path $Path -ItemType Directory -Force -ErrorAction Stop |
| 45 | + New-Item -Path $Path\$MakeAlias -ItemType Directory -Force -ErrorAction Stop |
| 46 | + New-Item -Path $Path\$MakeAlias\$ModelAlias -ItemType Directory -Force -ErrorAction Stop |
| 47 | + if((Test-Path -Path $Path) -ne $true){"Unable to access exportpath"} |
| 48 | + |
| 49 | + Export-WindowsDriver -Online -Destination $Path\$MakeAlias\$ModelAlias |
| 50 | + $items = Get-ChildItem -Path $Path\$MakeAlias\$ModelAlias -Filter PRN* |
| 51 | + foreach ($item in $items){ |
| 52 | + Remove-Item -Path $item.fullname -Recurse -Force |
| 53 | + } |
| 54 | + |
| 55 | + $SourceDirectory = "$Path\$MakeAlias\$ModelAlias" |
| 56 | + Set-Content -Path $("$Path\$MakeAlias\$ModelAlias.csv") -Value "Make,Model,Baseboard,Platform,Operating System,Architecture,Version,Source Directory" |
| 57 | + Add-Content -Path $("$Path\$MakeAlias\$ModelAlias.csv") -Value "$MakeAlias,$ModelAlias,$BaseBoard,$Platform,$WindowsVersion,$Architecture,$Version,$SourceDirectory" |
| 58 | +} |
| 59 | + |
| 60 | +Export-TSxWindowsDriver -Path \\SCCM\Drivers$\W101709 -Platform ConfigMgr -WindowsVersion "Windows 10" -Version '1.0' -Architecture x64 |
0 commit comments