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