Update samy.ps1
This commit is contained in:
20
samy.ps1
20
samy.ps1
@@ -2224,22 +2224,38 @@ function Ensure-SamyPrinterDriver {
|
||||
throw "Failed to expand driver package '$localZip': $($_.Exception.Message)"
|
||||
}
|
||||
|
||||
# If we don't yet have an INF path, try to derive it from DriverInfName
|
||||
# If we don't yet have an INF path, try to derive it from DriverInfName
|
||||
if (-not $infPath) {
|
||||
if ($Profile.PSObject.Properties.Name -contains 'DriverInfName' -and $Profile.DriverInfName) {
|
||||
|
||||
# 1) First try: directly under the destination root
|
||||
$candidateInf = Join-Path $localDriverRoot $Profile.DriverInfName
|
||||
if (Test-Path $candidateInf) {
|
||||
$infPath = $candidateInf
|
||||
Write-LogHybrid "Resolved INF from package as '$infPath' using DriverInfName '$($Profile.DriverInfName)'." Info Printers -LogToEvent
|
||||
Write-LogHybrid "Resolved INF from package as '$infPath' using DriverInfName '$($Profile.DriverInfName)' at root." Info Printers -LogToEvent
|
||||
}
|
||||
else {
|
||||
Write-LogHybrid "Expected INF '$candidateInf' (from DriverInfName) not found after expanding package." Warning Printers -LogToEvent
|
||||
Write-LogHybrid "Expected INF '$candidateInf' (from DriverInfName) not found at root; searching recursively..." Warning Printers -LogToEvent
|
||||
|
||||
# 2) Second try: search subfolders for that INF name
|
||||
$found = Get-ChildItem -Path $localDriverRoot -Recurse -Filter $Profile.DriverInfName -File -ErrorAction SilentlyContinue |
|
||||
Select-Object -First 1
|
||||
|
||||
if ($found) {
|
||||
$infPath = $found.FullName
|
||||
Write-LogHybrid "Resolved INF from package as '$infPath' (found by recursive search for '$($Profile.DriverInfName)')." Info Printers -LogToEvent
|
||||
}
|
||||
else {
|
||||
Write-LogHybrid "Could not find any '$($Profile.DriverInfName)' under '$localDriverRoot' after expanding package." Error Printers -LogToEvent
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
Write-LogHybrid "DriverInfName not defined for profile '$($Profile.ProfileName)'; cannot auto-resolve INF from expanded package." Warning Printers -LogToEvent
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user