Update samy.ps1

This commit is contained in:
2025-12-05 18:05:48 -05:00
parent 5f3eea39a5
commit 45463e6e05

View File

@@ -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(