imaging: load Send-PxeStatus at script scope + bump QR size to 160px
Monitor-IntuneProgress.ps1: the previous Ensure-SendPxeStatus function ran '. $lib' from inside the function body. PowerShell's dot-source- inside-function semantics put the imported Send-PxeStatus into the function's LOCAL scope, not the script scope. By the time Get-Phase1 called Get-Command Send-PxeStatus, the function had already returned and Send-PxeStatus was out of scope - silently never invoked, no log entry at all (success or failure). Diagnostic confirmed: bay had DeviceId in dsregcmd, manual Send-PxeStatus from operator prompt fired idx=7 cleanly with QR rendered, but Monitor's automatic call never showed up in C:\Logs\send-pxe-status.log. Fix: dot-source at script top-level (outside any function). Then Send-PxeStatus is in script scope where every function in the file can call it. Keep Ensure-SendPxeStatus as a no-op stub for any caller still invoking it. imaging.html: bump QR data-qr-size from 56 to 160 px. A 36-char UUID at ECC M needs ~29x29 modules; at 56px each module was ~1.5px which is too tight for a phone camera to lock onto from typical distance. 160 px gives ~5 px/module which scans cleanly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -188,16 +188,18 @@ $script:cache = @{
|
||||
DeviceIdReported = $false
|
||||
}
|
||||
|
||||
# Lazy-load Send-PxeStatus so the dashboard can render a QR of the Intune
|
||||
# device GUID as soon as it's captured. Dot-source path mirrors the helper
|
||||
# usage in the 09-Setup-*.ps1 scripts.
|
||||
$script:sendPxeStatusLoaded = $false
|
||||
# Load Send-PxeStatus at SCRIPT scope (not inside a function). A dot-source
|
||||
# inside a function defines the imported function in that function's local
|
||||
# scope only, so callers from other functions can't see it and Get-Command
|
||||
# Send-PxeStatus returns nothing. Loading at the top of the script puts
|
||||
# Send-PxeStatus in script scope where every function can find it.
|
||||
$pxeStatusLib = Join-Path $PSScriptRoot 'Send-PxeStatus.ps1'
|
||||
if (Test-Path $pxeStatusLib) {
|
||||
try { . $pxeStatusLib } catch { Write-Warning "Send-PxeStatus dot-source failed: $_" }
|
||||
}
|
||||
function Ensure-SendPxeStatus {
|
||||
if ($script:sendPxeStatusLoaded) { return }
|
||||
$lib = Join-Path $PSScriptRoot 'Send-PxeStatus.ps1'
|
||||
if (Test-Path $lib) {
|
||||
try { . $lib; $script:sendPxeStatusLoaded = $true } catch { }
|
||||
}
|
||||
# Kept as a no-op shim for any callers that still invoke it. Real load
|
||||
# happens at script init above.
|
||||
}
|
||||
|
||||
function Get-Phase1 {
|
||||
|
||||
Reference in New Issue
Block a user