The error you are receiving is because the INF file you are trying to install does not have digital signature information. To bypass this error, you can use the following PowerShell script to install the printer driver:
$infPath = "C:\temp\hpPrinter\autorun.inf"
$driverPackage = Get-Item $infPath | Select-Object -ExpandProperty VersionInfo | Select-Object -ExpandProperty FileName
$driverPackageName = $driverPackage.Substring(0, $driverPackage.IndexOf("."))
# Import the driver package
pnputil.exe -a $infPath
# Install the driver
$infPath = "C:\Windows\inf\$driverPackage"
Add-PrinterDriver -Name $driverPackageName -InfPath $infPath
In this script, we first get the name of the driver package from the INF file. Then we use pnputil.exe
to import the driver package. Finally, we use Add-PrinterDriver
cmdlet to install the driver.
Please note that this script assumes that the INF file contains the correct driver package name and that you have administrative privileges to install the printer driver.