Files
inno-installers/HPOfflineInstaller/test_hp_install.bat
cproudlock 28541cd3ed Initial commit: Inno Setup installer packages
Installer packages for GE manufacturing tools:
- BlueSSOFix: Blue SSO authentication fix
- HIDCardPrinter: HID card printer setup
- HPOfflineInstaller: HP printer offline installer
- MappedDrive: Network drive mapping
- PrinterInstaller: General printer installer
- ShopfloorConnect: Shopfloor connectivity tool
- XeroxOfflineInstaller: Xerox printer offline installer

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 13:15:54 -05:00

180 lines
5.1 KiB
Batchfile

@echo off
REM Test script for HP driver installation
REM Run as Administrator
REM Tests the same commands used by HPOfflineInstaller.exe
setlocal enabledelayedexpansion
echo.
echo ============================================
echo HP Driver Installation Test Script
echo Run as Administrator
echo ============================================
echo.
REM Set path to your driver folder (adjust as needed)
set "DRIVER_DIR=C:\temp\hp_drivers"
set "CAT_FILE=%DRIVER_DIR%\hpcu345u.cat"
set "INF_FILE=%DRIVER_DIR%\hpcu345u.inf"
set "DRIVER_NAME=HP Universal Printing PCL 6"
echo Driver directory: %DRIVER_DIR%
echo.
REM ============================================
echo TEST 1: Check if files exist
echo ============================================
echo.
if exist "%CAT_FILE%" (
echo [OK] Catalog file: %CAT_FILE%
) else (
echo [FAIL] Catalog file NOT found: %CAT_FILE%
echo.
echo Please copy HP driver files to %DRIVER_DIR%
echo Required files: hpcu345u.cat, hpcu345u.inf, and all driver files
echo.
pause
exit /b 1
)
if exist "%INF_FILE%" (
echo [OK] INF file: %INF_FILE%
) else (
echo [FAIL] INF file NOT found: %INF_FILE%
pause
exit /b 1
)
echo.
REM ============================================
echo TEST 2: Add catalog to TrustedPublisher store
echo ============================================
echo.
echo Running: certutil -addstore TrustedPublisher "%CAT_FILE%"
echo.
certutil -addstore TrustedPublisher "%CAT_FILE%"
set CERT_RESULT=!errorlevel!
echo.
echo Exit code: %CERT_RESULT%
if %CERT_RESULT% equ 0 (
echo [OK] Certificate catalog added successfully
) else (
echo [INFO] certutil returned %CERT_RESULT% - may already be installed
)
echo.
REM ============================================
echo TEST 2b: Disable driver signature enforcement
echo ============================================
echo.
REM Method 1: Set policy to Ignore (0) via registry
echo Setting driver signing policy to Ignore...
reg add "HKLM\SOFTWARE\Microsoft\Driver Signing" /v Policy /t REG_BINARY /d 00 /f
echo Exit code: %errorlevel%
REM Method 2: Disable via Group Policy registry
echo.
echo Disabling driver signing via Group Policy registry...
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Driver Signing" /v BehaviorOnFailedVerify /t REG_DWORD /d 0 /f 2>nul
echo Exit code: %errorlevel%
REM Method 3: Set Code Integrity policy
echo.
echo Setting Code Integrity policy...
reg add "HKLM\SYSTEM\CurrentControlSet\Control\CI" /v UMCIDisabled /t REG_DWORD /d 1 /f 2>nul
echo.
REM ============================================
echo TEST 3: Install driver with pnputil
echo ============================================
echo.
REM Try Windows 7 syntax first (works on all versions)
echo Running: pnputil -i -a "%INF_FILE%"
echo (-i = install, -a = add driver package)
echo.
pnputil -i -a "%INF_FILE%"
set PNPRESULT=!errorlevel!
echo.
echo Exit code: %PNPRESULT%
REM If Windows 7 syntax fails, try Windows 10+ syntax
if !PNPRESULT! neq 0 (
echo.
echo Trying Windows 10+ syntax...
echo Running: pnputil /add-driver "%INF_FILE%" /install
echo.
pnputil /add-driver "%INF_FILE%" /install
set PNPRESULT=!errorlevel!
echo.
echo Exit code: !PNPRESULT!
)
echo.
if !PNPRESULT! equ 0 (
echo [OK] Driver added to store successfully
) else if !PNPRESULT! equ 259 (
echo [OK] Driver already in store
) else (
echo [WARN] pnputil returned !PNPRESULT! - check output above for details
)
echo.
REM ============================================
echo TEST 4: Verify driver installation
echo ============================================
echo.
echo Checking if driver is registered with print spooler...
echo.
REM Try PowerShell method (Windows 10+)
powershell -NoProfile -Command "Get-PrinterDriver -Name '%DRIVER_NAME%' -ErrorAction SilentlyContinue | Select-Object Name, PrinterEnvironment" 2>nul
if %errorlevel% equ 0 (
echo.
echo [OK] Driver found via PowerShell
) else (
echo PowerShell check failed - trying wmic...
wmic printer driver where "name like '%%HP%%Universal%%'" get name 2>nul
)
echo.
REM ============================================
echo TEST 5: Check TrustedPublisher store
echo ============================================
echo.
echo Certificates/CTLs containing "HP" in TrustedPublisher:
certutil -store TrustedPublisher | findstr /i "HP"
if %errorlevel% neq 0 (
echo (No HP entries found - checking for Hewlett-Packard...)
certutil -store TrustedPublisher | findstr /i "Hewlett"
)
echo.
REM ============================================
echo SUMMARY
echo ============================================
echo.
echo Results:
echo - Certificate install (TEST 2): Exit code %CERT_RESULT%
echo - Driver install (TEST 3): Exit code %PNPRESULT%
echo.
echo If both exit codes are 0 or 1, installation succeeded!
echo.
echo Next: Connect your HP printer via USB.
echo Windows should automatically detect and configure it.
echo.
echo ============================================
echo.
pause