|
| 1 | +# Verify QZ Tray Certificate Setup |
| 2 | + |
| 3 | +Write-Host "`n========================================" -ForegroundColor Cyan |
| 4 | +Write-Host "QZ Tray Certificate Verification" -ForegroundColor Cyan |
| 5 | +Write-Host "========================================`n" -ForegroundColor Cyan |
| 6 | + |
| 7 | +$allGood = $true |
| 8 | + |
| 9 | +# Check 1: User directory |
| 10 | +$userCert = "$env:USERPROFILE\.qz\override.crt" |
| 11 | +Write-Host "[1] User Config: $userCert" -ForegroundColor White |
| 12 | +if (Test-Path $userCert) { |
| 13 | + $content = Get-Content $userCert -Raw |
| 14 | + if ($content -match "BEGIN CERTIFICATE") { |
| 15 | + Write-Host " Status: OK (X.509 Certificate)" -ForegroundColor Green |
| 16 | + } else { |
| 17 | + Write-Host " Status: WRONG FORMAT (not a certificate)" -ForegroundColor Red |
| 18 | + $allGood = $false |
| 19 | + } |
| 20 | +} else { |
| 21 | + Write-Host " Status: NOT FOUND" -ForegroundColor Red |
| 22 | + $allGood = $false |
| 23 | +} |
| 24 | + |
| 25 | +# Check 2: Program Files |
| 26 | +$progCert = "C:\Program Files\QZ Tray\override.crt" |
| 27 | +Write-Host "`n[2] Program Files: $progCert" -ForegroundColor White |
| 28 | +if (Test-Path $progCert) { |
| 29 | + $content = Get-Content $progCert -Raw |
| 30 | + if ($content -match "BEGIN CERTIFICATE") { |
| 31 | + Write-Host " Status: OK (X.509 Certificate)" -ForegroundColor Green |
| 32 | + } else { |
| 33 | + Write-Host " Status: WRONG FORMAT (not a certificate)" -ForegroundColor Red |
| 34 | + $allGood = $false |
| 35 | + } |
| 36 | +} else { |
| 37 | + Write-Host " Status: NOT FOUND (run admin script to copy)" -ForegroundColor Yellow |
| 38 | +} |
| 39 | + |
| 40 | +# Check 3: Frontend asset |
| 41 | +$frontendCert = "src\assets\digital-certificate.txt" |
| 42 | +Write-Host "`n[3] Frontend Asset: $frontendCert" -ForegroundColor White |
| 43 | +if (Test-Path $frontendCert) { |
| 44 | + $content = Get-Content $frontendCert -Raw |
| 45 | + if ($content -match "BEGIN CERTIFICATE") { |
| 46 | + Write-Host " Status: OK (X.509 Certificate)" -ForegroundColor Green |
| 47 | + } else { |
| 48 | + Write-Host " Status: WRONG FORMAT" -ForegroundColor Red |
| 49 | + $allGood = $false |
| 50 | + } |
| 51 | +} else { |
| 52 | + Write-Host " Status: NOT FOUND" -ForegroundColor Red |
| 53 | + $allGood = $false |
| 54 | +} |
| 55 | + |
| 56 | +# Check 4: QZ Tray running |
| 57 | +Write-Host "`n[4] QZ Tray Process" -ForegroundColor White |
| 58 | +$qzRunning = $false |
| 59 | +$javaw = Get-Process javaw -ErrorAction SilentlyContinue |
| 60 | +if ($javaw) { |
| 61 | + foreach ($proc in $javaw) { |
| 62 | + $cmdLine = (Get-CimInstance Win32_Process -Filter "ProcessId = $($proc.Id)" -ErrorAction SilentlyContinue).CommandLine |
| 63 | + if ($cmdLine -like "*qz-tray*") { |
| 64 | + Write-Host " Status: RUNNING (PID: $($proc.Id))" -ForegroundColor Yellow |
| 65 | + Write-Host " WARNING: Restart QZ Tray to load new certificate!" -ForegroundColor Red |
| 66 | + $qzRunning = $true |
| 67 | + $allGood = $false |
| 68 | + break |
| 69 | + } |
| 70 | + } |
| 71 | +} |
| 72 | +if (-not $qzRunning) { |
| 73 | + Write-Host " Status: Not running (good - start it now)" -ForegroundColor Green |
| 74 | +} |
| 75 | + |
| 76 | +# Summary |
| 77 | +Write-Host "`n========================================" -ForegroundColor Cyan |
| 78 | +if ($allGood) { |
| 79 | + Write-Host "ALL CHECKS PASSED!" -ForegroundColor Green |
| 80 | + Write-Host "`nYou can now:" -ForegroundColor White |
| 81 | + Write-Host "1. Start QZ Tray" -ForegroundColor White |
| 82 | + Write-Host "2. Clear browser cache" -ForegroundColor White |
| 83 | + Write-Host "3. Test printing" -ForegroundColor White |
| 84 | +} else { |
| 85 | + Write-Host "SOME ISSUES FOUND" -ForegroundColor Yellow |
| 86 | + Write-Host "`nAction required:" -ForegroundColor White |
| 87 | + Write-Host "1. Restart QZ Tray if running" -ForegroundColor White |
| 88 | + Write-Host "2. Verify certificates are in X.509 format" -ForegroundColor White |
| 89 | +} |
| 90 | +Write-Host "========================================`n" -ForegroundColor Cyan |
| 91 | + |
| 92 | +Read-Host "Press Enter to exit" |
0 commit comments