diff --git a/samy.ps1 b/samy.ps1 index ad26450..bcdf391 100644 --- a/samy.ps1 +++ b/samy.ps1 @@ -2258,13 +2258,13 @@ function Ensure-SamyPrinterDriver { # We just continue – maybe a local INF exists or will exist. } else { - Write-LogHybrid "Driver package download failed ($statusCode) from $driverPackageUrl: $($_.Exception.Message)" Error Printers -LogToEvent - throw "Failed to download driver package from $driverPackageUrl: $($_.Exception.Message)" + Write-LogHybrid "Driver package download failed ($statusCode) from $($driverPackageUrl): $($_.Exception.Message)" Error Printers -LogToEvent + throw "Failed to download driver package from $($driverPackageUrl): $($_.Exception.Message)" } } catch { - Write-LogHybrid "Driver package download failed from $driverPackageUrl: $($_.Exception.Message)" Error Printers -LogToEvent - throw "Failed to download driver package from $driverPackageUrl: $($_.Exception.Message)" + Write-LogHybrid "Driver package download failed from $($driverPackageUrl): $($_.Exception.Message)" Error Printers -LogToEvent + throw "Failed to download driver package from $($driverPackageUrl): $($_.Exception.Message)" } } else { @@ -2303,22 +2303,17 @@ function Ensure-SamyPrinterDriver { } # ----------------------------- - # 3) Legacy fallback: if you still want to use Get-SamyDriverInfFromRepo when we have no INF - # (optional – keep or remove depending on whether you still use that helper) + # 3) Optional legacy helper # ----------------------------- if (-not $infPath) { if ($Profile.PSObject.Properties.Name -contains 'DriverPackageUrl' -or $Profile.PSObject.Properties.Name -contains 'DriverPackagePath') { - # If you still have this helper and like its behavior, keep this: try { $infPath = Get-SamyDriverInfFromRepo -Profile $Profile } catch { - # If that helper throws on 404, you'll still see an error, so you might choose - # to *remove* this block once you're happy with the new archive behavior. Write-LogHybrid "Get-SamyDriverInfFromRepo failed: $($_.Exception.Message)" Error Printers -LogToEvent - # Re-throw or not depending on how strict you want to be: throw } } @@ -2333,10 +2328,8 @@ function Ensure-SamyPrinterDriver { Write-LogHybrid "Installing printer driver '$driverName' from '$infPath'." Info Printers -LogToEvent - # Install with pnputil pnputil.exe /add-driver "`"$infPath`"" /install | Out-Null - # Verify $existingDriver = Get-PrinterDriver -Name $driverName -ErrorAction SilentlyContinue if (-not $existingDriver) { throw "Failed to install printer driver '$driverName' from '$infPath'." @@ -2347,6 +2340,7 @@ function Ensure-SamyPrinterDriver { + function Install-SamyTcpIpPrinter { [CmdletBinding()] param(