Copiez et collez cet exemple de script et modifiez-le si nécessaire pour votre environnement :

<# . SYNOPSIS     Affiche la status actuelle de l’orchestrateur de déploiement de démarrage sécurisé.

.DESCRIPTION     Fournit une visibilité en temps réel de la progression du déploiement :     - Numéro d’onde actuel et appareils ciblés     - Appareils mis à jour ou en attente     - Compartiments bloqués nécessitant une attention particulière     - Journal d’activité récent     - Lien du tableau de bord     Exécutez cette commande à tout moment pour voir la progression du déploiement.     

.PARAMETER ReportBasePath     Chemin d’accès au répertoire de rapport/d’état utilisé par l’orchestrateur

.PARAMETER ShowLog     Afficher les entrées de journal récentes (50 dernières lignes)

.PARAMETER ShowBlocked     Afficher les détails des compartiments bloqués

.PARAMETER ShowWaves     Afficher l’historique des vagues avec le nombre d’appareils

.PARAMETER Watch     Actualiser en continu status toutes les N secondes

.PARAMETER OpenDashboard     Ouvrir le dernier tableau de bord HTML dans le navigateur

.EXAMPLE     .\Get-SecureBootRolloutStatus.ps1 -ReportBasePath « C :\SecureBootReports »

.EXAMPLE     .\Get-SecureBootRolloutStatus.ps1 -ReportBasePath « C :\SecureBootReports » -Watch 30

.EXAMPLE     .\Get-SecureBootRolloutStatus.ps1 -ReportBasePath « C :\SecureBootReports » -OpenDashboard #>

[CmdletBinding()] param(     [Parameter(Mandatory = $true)]     [string]$ReportBasePath,     [Parameter(Mandatory = $false)]     [switch]$ShowLog,     [Parameter(Mandatory = $false)]     [switch]$ShowBlocked,     [Parameter(Mandatory = $false)]     [switch]$ShowWaves,     [Parameter(Mandatory = $false)]     [int]$Watch = 0,     [Parameter(Mandatory = $false)]     [switch]$OpenDashboard )                         

$ErrorActionPreference = "Stop" $DownloadUrl = « https://aka.ms/getsecureboot » $DownloadSubPage = « Exemples de déploiement et de surveillance »

# Note: This script has no dependencies on other scripts. # Pour l’ensemble d’outils complet, téléchargez à partir de : $DownloadUrl -> $DownloadSubPage

# ============================================================================ # FONCTIONS D’ASSISTANCE # ============================================================================

function ConvertTo-Hashtable {     param([Parameter(ValueFromPipeline = $true)]$InputObject)     process {         if ($null -eq $InputObject) { return @{} }         if ($InputObject -is [System.Collections.IDictionary]) { return $InputObject }         if ($InputObject -is [PSCustomObject]) {             $hash = @{}             foreach ($prop dans $InputObject.PSObject.Properties) {                 $hash[$prop. Name] = ConvertTo-Hashtable $prop. Valeur             }             $hash de retour         }         if ($InputObject -is [System.Collections.IEnumerable] -and $InputObject -isnot [string]) {             return @($InputObject | ForEach-Object { ConvertTo-Hashtable $_ })         }         $InputObject de retour     } }

function Show-Status {     $stateDir = Join-Path $ReportBasePath « RolloutState »     $rolloutStatePath = Join-Path $stateDir « RolloutState.json »     $blockedBucketsPath = Join-Path $stateDir « BlockedBuckets.json »     Clear-Host     Write-Host «  »     Write-Host (« = » * 80) -ForegroundColor Cyan     Write-Host « SECURE BOOT ROLLOUT STATUS » -ForegroundColor Cyan     Write-Host " $(Get-Date -Format 'aaaa-MM-dd HH :mm :ss') » -ForegroundColor Gray     Write-Host (« = » * 80) -ForegroundColor Cyan     Write-Host «  »     # Vérifier si la tâche d’orchestrateur est en cours d’exécution     $task = Get-ScheduledTask -TaskName « SecureBoot-Rollout-Orchestrator » -ErrorAction SilentlyContinue     if ($task) {         $taskState = $task. État         $color = if ($taskState -eq « Running ») { « Green » } elseif ($taskState -eq « Ready ») { « Yellow » } else { « Red » }         Write-Host « Tâche planifiée : » -NoNewline         Write-Host $taskState -ForegroundColor $color     } else {         Write-Host « Tâche planifiée : » -NoNewline         Write-Host « Non installé » -ForegroundColor Gray     }     Nombre d’états de déploiement de chargement     if (-not (Test-Path $rolloutStatePath)) {         Write-Host «  »         Write-Host « Aucun état de déploiement trouvé.                Orchestrator n’a peut-être pas encore démarré." -ForegroundColor Yellow         Write-Host « State path : $rolloutStatePath » -ForegroundColor Gray         Retour     }     $state = Get-Content $rolloutStatePath -Raw | ConvertFrom-Json | ConvertTo-Hashtable     Write-Host «  »     Write-Host « PROGRESSION DU DÉPLOIEMENT » -ForegroundColor Yellow     Write-Host (« - » * 40)     $status = $state. Statut     $statusColor = switch ($status) {         « Completed » { « Green » }         « InProgress » { « Cyan » }         « NotStarted » { « Gray » }         default { « White » }     }     Write-Host « Status : " -NoNewline     Write-Host $status -ForegroundColor $statusColor     Write-Host « Current Wave : $($state. CurrentWave)"     Write-Host « Total ciblé : $($state. TotalDevicesTargeted)"     Write-Host « Total des mises à jour : $($state. TotalDevicesUpdated)"     if ($state. StartedAt) {         Write-Host « Démarré : $($state. StartedAt)"     }     if ($state. LastAggregation) {         Write-Host « Dernière vérification : $($state. LastAggregation)"     }     if ($state. CompletedAt) {         Write-Host « Terminé : $($state. CompletedAt)" -ForegroundColor Vert     }     # Afficher la barre de progression     if ($state. TotalDevicesTargeted -gt 0) {         $pct = if ($state. TotalDevicesUpdated et $state. TotalDevicesTargeted) {             [math] ::Round(($state. TotalDevicesUpdated / $state. TotalDevicesTargeted) * 100, 1)         } else { 0 }         Write-Host «  »         Write-Host « Progress : " -NoNewline         $barWidth = 40         $filled = [math] ::Floor($barWidth * $pct / 100)         Write-Host « [ » -NoNewline         Write-Host (« )] » * $filled) -ForegroundColor Vert -NoNewline         Write-Host (« ░ » * ($barWidth - $filled)) -ForegroundColor DarkGray -NoNewline         Write-Host « ] $pct % »     }     Résumé du nombre de compartiments bloqués     if (Test-Path $blockedBucketsPath) {         $blocked = Get-Content $blockedBucketsPath -Raw | ConvertFrom-Json | ConvertTo-Hashtable         if ($blocked. Count -gt 0) {             Write-Host «  »             Write-Host « BLOCKED BUCKETS : " -NoNewline -ForegroundColor Red             Write-Host "$($blocked. Count) buckets need attention" -ForegroundColor Red             if ($ShowBlocked) {                 Write-Host «  »                 foreach ($key dans $blocked. Clés) {                     $info = $blocked[$key]                     Write-Host " ► $key » -ForegroundColor Red                     Write-Host " Raison : $($info. Reason)" -ForegroundColor Gray                     Write-Host " Appareil : $($info. FailedDevice)" -ForegroundColor Gray                     Write-Host " Depuis : $($info. BlockedAt)" -ForegroundColor Gray                 }             } else {                 Write-Host « Exécuter avec -ShowBlocked pour plus de détails » -ForegroundColor Gray             }         }     }     # Historique des vagues     si ($ShowWaves -et $state. WaveHistory - et $state. WaveHistory.Count -gt 0) {         Write-Host «  »         Write-Host « WAVE HISTORY » -ForegroundColor Yellow         Write-Host (« - » * 40)         foreach ($wave dans $state. WaveHistory) {             Write-Host "Wave $($wave. WaveNumber) : " -NoNewline -ForegroundColor Cyan             Write-Host "$($wave. Appareils DeviceCount) » -NoNewline             Write-Host " - $($wave. StartedAt)" -ForegroundColor Gray         }     }     # Dernier tableau de bord     $latestAggregation = Get-ChildItem -Path $ReportBasePath -Directory -Filter « Aggregation_* » -ErrorAction SilentlyContinue |         nom Sort-Object -Décroissant |         Select-Object -First 1     if ($latestAggregation) {         $dashboard = Get-ChildItem -Path $latestAggregation.FullName -Filter « *Dashboard*.html » -ErrorAction SilentlyContinue |             Select-Object -First 1         if ($dashboard) {             Write-Host «  »             Write-Host « LATEST DASHBOARD » -ForegroundColor Yellow             Write-Host $dashboard. FullName -ForegroundColor Gray             if ($OpenDashboard) {                 Start-Process $dashboard. Fullname             }         }     }     # Journal récent     if ($ShowLog) {         $logFile = Get-ChildItem -Path $stateDir -Filter « Orchestrator_*.log » -ErrorAction SilentlyContinue |             nom Sort-Object -Décroissant |             Select-Object -First 1         if ($logFile) {             Write-Host «  »             Write-Host « RECENT LOG » -ForegroundColor Yellow             Write-Host (« - » * 40)             Get-Content $logFile.FullName -Tail 20 | ForEach-Object {                 if ($_ -match '\[ERROR\]') {                     Write-Host $_ -ForegroundColor Red                 } elseif ($_ -match '\[WARN\]') {                     Write-Host $_ -ForegroundColor Yellow                 } elseif ($_ -match '\[OK\]') {                     Write-Host $_ -ForegroundColor Vert                 } elseif ($_ -match '\[WAVE\]') {                     Write-Host $_ -ForegroundColor Cyan                 } else {                     Write-Host $_ -ForegroundColor Gray                 }             }         }     }     Write-Host «  »     Write-Host (« - » * 80) -ForegroundColor DarkGray     si (-not $ShowLog -or -not $ShowWaves -or -not $ShowBlocked) {         Write-Host « Options : -ShowLog | -ShowWaves | -ShowBlocked | -OpenDashboard | -Watch 30" -ForegroundColor DarkGray     } }                                                                                                                                            

# ============================================================================ # MAIN # ============================================================================

if (-not (Test-Path $ReportBasePath)) {     Write-Host « Chemin d’accès au rapport introuvable : $ReportBasePath » -ForegroundColor Red     sortie 1 }

if ($Watch -gt 0) {     Write-Host « Regarder status toutes les $Watch secondes. Appuyez sur Ctrl+C pour arrêter." -ForegroundColor Cyan     while ($true) {         Afficher l’état         Start-Sleep -Secondes $Watch     } } else {     Afficher l’état }  

Besoin d’aide ?

Vous voulez plus d’options ?

Explorez les avantages de l’abonnement, parcourez les cours de formation, découvrez comment sécuriser votre appareil, etc.