Add QR code display of Intune device ID to sync tool
Bundles QRCoder.dll (184KB, .NET 4.0) to render the Azure AD device GUID as a scannable QR code in the console when sync_intune.bat runs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
BIN
playbook/shopfloor-setup/Shopfloor/QRCoder.dll
Executable file
BIN
playbook/shopfloor-setup/Shopfloor/QRCoder.dll
Executable file
Binary file not shown.
@@ -10,10 +10,35 @@ if %errorlevel% neq 0 (
|
|||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ========================================
|
echo ========================================
|
||||||
echo Intune Policy Sync
|
echo Intune Policy Sync - %COMPUTERNAME%
|
||||||
echo ========================================
|
echo ========================================
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
|
:: Show Intune Device ID and QR code
|
||||||
|
powershell -ExecutionPolicy Bypass -Command ^
|
||||||
|
"$dsreg = dsregcmd /status 2>&1; "^
|
||||||
|
"$line = $dsreg | Select-String 'DeviceId'; "^
|
||||||
|
"if ($line) { "^
|
||||||
|
" $deviceId = $line.ToString().Split(':')[1].Trim(); "^
|
||||||
|
" Write-Host \"Intune Device ID: $deviceId\" -ForegroundColor Cyan; "^
|
||||||
|
" Write-Host ''; "^
|
||||||
|
" $dllPath = 'C:\Enrollment\shopfloor-setup\Shopfloor\QRCoder.dll'; "^
|
||||||
|
" if (Test-Path $dllPath) { "^
|
||||||
|
" Add-Type -Path $dllPath; "^
|
||||||
|
" $gen = New-Object QRCoder.QRCodeGenerator; "^
|
||||||
|
" $data = $gen.CreateQrCode($deviceId, [QRCoder.QRCodeGenerator+ECCLevel]::L); "^
|
||||||
|
" $ascii = New-Object QRCoder.AsciiQRCode($data); "^
|
||||||
|
" $qr = $ascii.GetGraphic(1, [char]0x2588 + [char]0x2588, ' '); "^
|
||||||
|
" Write-Host $qr; "^
|
||||||
|
" } else { "^
|
||||||
|
" Write-Host 'QRCoder.dll not found - skipping QR code' -ForegroundColor Yellow; "^
|
||||||
|
" } "^
|
||||||
|
"} else { "^
|
||||||
|
" Write-Host 'Device not yet Azure AD joined.' -ForegroundColor Yellow; "^
|
||||||
|
"}"
|
||||||
|
|
||||||
|
echo.
|
||||||
|
|
||||||
:: Check current state
|
:: Check current state
|
||||||
reg query "HKLM\Software\GE\SFLD" >nul 2>&1
|
reg query "HKLM\Software\GE\SFLD" >nul 2>&1
|
||||||
if %errorlevel% equ 0 (
|
if %errorlevel% equ 0 (
|
||||||
|
|||||||
Reference in New Issue
Block a user