mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-07-04 20:23:52 -05:00
Update Invoke-WPFMicrowin.ps1
Use the driver injection directory if it is specified and if the directory exists
This commit is contained in:
@ -112,20 +112,6 @@ public class PowerManagement {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($injectDrivers)
|
|
||||||
{
|
|
||||||
$driverPath = $sync.MicrowinDriverLocation.Text
|
|
||||||
if (Test-Path $driverPath)
|
|
||||||
{
|
|
||||||
Write-Host "Adding Windows Drivers image($scratchDir) drivers($driverPath) "
|
|
||||||
dism /English /image:$scratchDir /add-driver /driver:$driverPath /recurse | Out-Host
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Write-Host "Path to drivers is invalid continuing without driver injection"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($importDrivers)
|
if ($importDrivers)
|
||||||
{
|
{
|
||||||
Write-Host "Exporting drivers from active installation..."
|
Write-Host "Exporting drivers from active installation..."
|
||||||
@ -133,6 +119,22 @@ public class PowerManagement {
|
|||||||
{
|
{
|
||||||
Remove-Item "$env:TEMP\DRV_EXPORT" -Recurse -Force
|
Remove-Item "$env:TEMP\DRV_EXPORT" -Recurse -Force
|
||||||
}
|
}
|
||||||
|
if (($injectDrivers -and (Test-Path $sync.MicrowinDriverLocation.Text)))
|
||||||
|
{
|
||||||
|
Write-Host "Using specified driver source..."
|
||||||
|
dism /english /online /export-driver /destination="$($sync.MicrowinDriverLocation.Text)" | Out-Host
|
||||||
|
if ($?)
|
||||||
|
{
|
||||||
|
# Don't add exported drivers yet, that is run later
|
||||||
|
Write-Host "Drivers have been exported successfully."
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Write-Host "Failed to export drivers."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
New-Item -Path "$env:TEMP\DRV_EXPORT" -ItemType Directory -Force
|
New-Item -Path "$env:TEMP\DRV_EXPORT" -ItemType Directory -Force
|
||||||
dism /english /online /export-driver /destination="$env:TEMP\DRV_EXPORT" | Out-Host
|
dism /english /online /export-driver /destination="$env:TEMP\DRV_EXPORT" | Out-Host
|
||||||
if ($?)
|
if ($?)
|
||||||
@ -149,6 +151,21 @@ public class PowerManagement {
|
|||||||
Remove-Item "$env:TEMP\DRV_EXPORT" -Recurse -Force
|
Remove-Item "$env:TEMP\DRV_EXPORT" -Recurse -Force
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($injectDrivers)
|
||||||
|
{
|
||||||
|
$driverPath = $sync.MicrowinDriverLocation.Text
|
||||||
|
if (Test-Path $driverPath)
|
||||||
|
{
|
||||||
|
Write-Host "Adding Windows Drivers image($scratchDir) drivers($driverPath) "
|
||||||
|
dism /English /image:$scratchDir /add-driver /driver:$driverPath /recurse | Out-Host
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Write-Host "Path to drivers is invalid continuing without driver injection"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Write-Host "Remove Features from the image"
|
Write-Host "Remove Features from the image"
|
||||||
Remove-Features -keepDefender:$keepDefender
|
Remove-Features -keepDefender:$keepDefender
|
||||||
|
Reference in New Issue
Block a user