New
#11
You're welcome...
I haven't tested in PE yet - the Enterprise story is a known registry bug with Pro.
I will look into this a bit later....
You're welcome...
I haven't tested in PE yet - the Enterprise story is a known registry bug with Pro.
I will look into this a bit later....
Yup, Edition is a problem in PE - is that required? Without it we can do this:
Code:if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit } $WinPEDrive = 'C' # Note: Change to $WinPEDrive = 'X' if running this script in WinPE $WinPEProduct = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' | Select-Object -ExpandProperty ProductName $WinPEArch = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' | Select-Object -ExpandProperty BuildLabEx $WinPECurrentVersion = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' | Select-Object -ExpandProperty CurrentVersion if ($WinPEArch.Split(".") -contains 'x86fre') {$WinPEArch = $true} else {$WinPEArch = $false} $Drives = Get-PSDrive -PSProvider FileSystem | Select-Object Name, Root | Where-Object {$_.Name -notcontains $WinPEDrive} foreach ($Drive in $Drives) { $HivePath = Join-Path($Drive.Root) -ChildPath "Windows\System32\config\SOFTWARE" if (Test-Path($HivePath)) { Reg.exe Load 'HKLM\TempHive' $HivePath | Out-Null $ProductName = Get-ItemProperty -Path 'HKLM:\TempHive\Microsoft\Windows NT\CurrentVersion' | Select-Object -ExpandProperty ProductName $BuildLabEx = Get-ItemProperty -Path 'HKLM:\TempHive\Microsoft\Windows NT\CurrentVersion' | Select-Object -ExpandProperty BuildLabEx $CurrentVersion = Get-ItemProperty -Path 'HKLM:\TempHive\Microsoft\Windows NT\CurrentVersion' | Select-Object -ExpandProperty CurrentVersion Reg.exe Unload 'HKLM\TempHive'| Out-Null if ($BuildLabEx.Split(".") -contains 'x86fre') {$Arch = $true} else {$Arch = $false} #If a Matching OS and Arch are found then export and integrate drivers if ($WinPECurrentVersion -eq $CurrentVersion -and $WinPEArch -eq $Arch){ Write-Host "Export drivers from " $HivePath.Replace("config\SOFTWARE", "Drivers") } else { Write-Host "No drivers to export " } } } Write-Host "Done" Read-Host
Last edited by Superfly; 03 Jul 2019 at 03:01.
you still up too.....
Just need Windows 10 / 8.1 and arch
Hello SIW2
I'll test tomorrow - if not i'll be all night over night
It is finding Drive by Arch in WinPE and Host..
Now can you have it list those "Found" drives By Windows Edition
Then Ask which $Drive - $Edition "do you want to export drivers from"
because eventually we will need just the $DriveLetter for our Dism command
dism /Image:$DriveLetter :\ /Export-Driver /Destination:"%UserProfile%\Desktop\ExportedDrivers"
I assumed $DriveLetter = single digit
Else
dism /Image:$DriveLetter /Export-Driver /Destination:"%UserProfile%\Desktop\ExportedDrivers"
PS I can test Export if you can add to script
Hmmm.... are drivers edition specific? PE seems to ignore edition - anyway regarding user choice see this one (note I removed edition) - I'll add the exact export cmd if the various scenarios passes testingCode:if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process PowerShell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs Exit } $WinPEDrive = $env:SystemDrive -replace ':' $WinPEArch = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' | Select-Object -ExpandProperty BuildLabEx $WinPECurrentVersion = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' | Select-Object -ExpandProperty CurrentVersion if ($WinPEArch -Split '.' -contains 'x86fre') {$WinPEArch = $true} else {$WinPEArch = $false} $Drives = Get-PSDrive -PSProvider FileSystem | Select-Object Name, Root | Where-Object {$_.Name -notcontains $WinPEDrive} $List = @() foreach ($Drive in $Drives) { $HivePath = Join-Path($Drive.Root) -ChildPath "Windows\System32\config\SOFTWARE" if (Test-Path($HivePath)) { Reg.exe Load 'HKLM\TempHive' $HivePath | Out-Null $BuildLabEx = Get-ItemProperty -Path 'HKLM:\TempHive\Microsoft\Windows NT\CurrentVersion' | Select-Object -ExpandProperty BuildLabEx $CurrentVersion = Get-ItemProperty -Path 'HKLM:\TempHive\Microsoft\Windows NT\CurrentVersion' | Select-Object -ExpandProperty CurrentVersion Reg.exe Unload 'HKLM\TempHive'| Out-Null if ($BuildLabEx -Split '.' -contains 'x86fre') {$Arch = $true} else {$Arch = $false} #If a Matching OS and Arch are found then export and integrate drivers if ($WinPECurrentVersion -eq $CurrentVersion -and $WinPEArch -eq $Arch){ $List += ($HivePath.Replace("config\SOFTWARE", "Drivers")) } else { Write-Host "No drivers to export " } } } #User choice export foreach($Item in $List) { Write-Host $Item } if ($List.Length -gt 1) { Write-Host "`r`n" Write-Host "Choose a Drive letter from the above list from which to export..." $Drive = Read-Host foreach($Item in $List){ if ($Item.StartsWith($Drive.ToUpper())) {Write-Host "Exporting.... " $Item} } } else { Write-Host "Exporting.... " $Item } Write-Host "Done" Read-Host
Last edited by Superfly; 03 Jul 2019 at 15:55.
Yes, There are Drivers For Windows 8 and There are Drivers for Windows 10Hmmm.... are drivers edition specific?
No Difference between Home, Pro, Enterprise Drivers
Test from Post 12 in PE shows all x64 OS's
E:\ is Windows 8.1
the other two are windows 10
Current Test lists all OS
Need some thing like to list $Driveletter and $edition - from test in post 12 which Matches against Arch
Export Drivers From $DriveLetter - $Edition
Export Drivers From E:\ - Windows 8.1 Pro
Export Drivers From F:\ - Windows 10 Pro
Export Drivers From I:\ - Windows 10 Pro
Try this one I think I got the versions wrong again
Code:if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process PowerShell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs Exit } $WinPEDrive = $env:SystemDrive -replace ':' $WinPEArch = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' | Select-Object -ExpandProperty BuildLabEx $WinPECurrentVersion = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' | Select-Object -ExpandProperty CurrentVersion if ($WinPEArch -Split '.' -contains 'x86fre') {$WinPEArch = $true} else {$WinPEArch = $false} $Drives = Get-PSDrive -PSProvider FileSystem | Select-Object Name, Root | Where-Object {$_.Name -notcontains $WinPEDrive} $List = @() foreach ($Drive in $Drives) { $HivePath = Join-Path($Drive.Root) -ChildPath "Windows\System32\config\SOFTWARE" if (Test-Path($HivePath)) { Reg.exe Load 'HKLM\TempHive' $HivePath | Out-Null $BuildLabEx = Get-ItemProperty -Path 'HKLM:\TempHive\Microsoft\Windows NT\CurrentVersion' | Select-Object -ExpandProperty BuildLabEx $CurrentVersion = Get-ItemProperty -Path 'HKLM:\TempHive\Microsoft\Windows NT\CurrentVersion' | Select-Object -ExpandProperty CurrentVersion Reg.exe Unload 'HKLM\TempHive'| Out-Null if ($BuildLabEx -Split '.' -contains 'x86fre') {$Arch = $true} else {$Arch = $false} #If a Matching OS and Arch are found then export and integrate drivers if ($WinPECurrentVersion -eq $CurrentVersion -and $WinPEArch -eq $Arch){ $List += ($HivePath.Replace("config\SOFTWARE", "Drivers")) } else { Write-Host "No drivers to export " } } } #User choice export foreach($Item in $List) { Write-Host $Item } if ($List.Length -gt 1) { Write-Host "`r`n" Write-Host "Choose a Drive letter from the above list from which to export..." $Drive = Read-Host foreach($Item in $List){ if ($Item.StartsWith($Drive.ToUpper())) {Write-Host "Exporting.... " $Item} } } else { Write-Host "Exporting.... " $Item } Write-Host "Done" Read-Host