Translate

samedi 18 avril 2026

Commandes de gouvernances PS1 Audit Interne

CLAUDE GOUVERNANCE :



PS C:\Users\erolg> claude --help

Usage: claude [options] [command] [prompt]

Claude Code - starts an interactive session by default, use -p/--print for non-interactive output

Arguments:
  prompt                                            Your prompt

Options:
  --add-dir <directories...>                        Additional directories to allow tool access to
  --agent <agent>                                   Agent for the current session. Overrides the 'agent' setting.
  --agents <json>                                   JSON object defining custom agents (e.g. '{"reviewer":
                                                    {"description": "Reviews code", "prompt": "You are a code
                                                    reviewer"}}')
  --allow-dangerously-skip-permissions              Enable bypassing all permission checks as an option, without it
                                                    being enabled by default. Recommended only for sandboxes with no
                                                    internet access.
  --allowedTools, --allowed-tools <tools...>        Comma or space-separated list of tool names to allow (e.g.
                                                    "Bash(git *) Edit")
  --append-system-prompt <prompt>                   Append a system prompt to the default system prompt
  --bare                                            Minimal mode: skip hooks, LSP, plugin sync, attribution,
                                                    auto-memory, background prefetches, keychain reads, and CLAUDE.md
                                                    auto-discovery. Sets CLAUDE_CODE_SIMPLE=1. Anthropic auth is
                                                    strictly ANTHROPIC_API_KEY or apiKeyHelper via --settings (OAuth
                                                    and keychain are never read). 3P providers (Bedrock/Vertex/Foundry)
                                                    use their own credentials. Skills still resolve via /skill-name.
                                                    Explicitly provide context via: --system-prompt[-file],
                                                    --append-system-prompt[-file], --add-dir (CLAUDE.md dirs),
                                                    --mcp-config, --settings, --agents, --plugin-dir.
  --betas <betas...>                                Beta headers to include in API requests (API key users only)
  --brief                                           Enable SendUserMessage tool for agent-to-user communication
  --chrome                                          Enable Claude in Chrome integration
  -c, --continue                                    Continue the most recent conversation in the current directory
  --dangerously-skip-permissions                    Bypass all permission checks. Recommended only for sandboxes with
                                                    no internet access.
  -d, --debug [filter]                              Enable debug mode with optional category filtering (e.g.,
                                                    "api,hooks" or "!1p,!file")
  --debug-file <path>                               Write debug logs to a specific file path (implicitly enables debug
                                                    mode)
  --disable-slash-commands                          Disable all skills
  --disallowedTools, --disallowed-tools <tools...>  Comma or space-separated list of tool names to deny (e.g. "Bash(git
                                                    *) Edit")
  --effort <level>                                  Effort level for the current session (low, medium, high, max)
  --exclude-dynamic-system-prompt-sections          Move per-machine sections (cwd, env info, memory paths, git status)
                                                    from the system prompt into the first user message. Improves
                                                    cross-user prompt-cache reuse. Only applies with the default system
                                                    prompt (ignored with --system-prompt). (default: false)
  --fallback-model <model>                          Enable automatic fallback to specified model when default model is
                                                    overloaded (only works with --print)
  --file <specs...>                                 File resources to download at startup. Format:
                                                    file_id:relative_path (e.g., --file file_abc:doc.txt
                                                    file_def:img.png)
  --fork-session                                    When resuming, create a new session ID instead of reusing the
                                                    original (use with --resume or --continue)
  --from-pr [value]                                 Resume a session linked to a PR by PR number/URL, or open
                                                    interactive picker with optional search term
  -h, --help                                        Display help for command
  --ide                                             Automatically connect to IDE on startup if exactly one valid IDE is
                                                    available
  --include-hook-events                             Include all hook lifecycle events in the output stream (only works
                                                    with --output-format=stream-json)
  --include-partial-messages                        Include partial message chunks as they arrive (only works with
                                                    --print and --output-format=stream-json)
  --input-format <format>                           Input format (only works with --print): "text" (default), or
                                                    "stream-json" (realtime streaming input) (choices: "text",
                                                    "stream-json")
  --json-schema <schema>                            JSON Schema for structured output validation. Example:
                                                    {"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}
  --max-budget-usd <amount>                         Maximum dollar amount to spend on API calls (only works with
                                                    --print)
  --mcp-config <configs...>                         Load MCP servers from JSON files or strings (space-separated)
  --mcp-debug                                       [DEPRECATED. Use --debug instead] Enable MCP debug mode (shows MCP
                                                    server errors)
  --model <model>                                   Model for the current session. Provide an alias for the latest
                                                    model (e.g. 'sonnet' or 'opus') or a model's full name (e.g.
                                                    'claude-sonnet-4-6').
  -n, --name <name>                                 Set a display name for this session (shown in /resume and terminal
                                                    title)
  --no-chrome                                       Disable Claude in Chrome integration
  --no-session-persistence                          Disable session persistence - sessions will not be saved to disk
                                                    and cannot be resumed (only works with --print)
  --output-format <format>                          Output format (only works with --print): "text" (default), "json"
                                                    (single result), or "stream-json" (realtime streaming) (choices:
                                                    "text", "json", "stream-json")
  --permission-mode <mode>                          Permission mode to use for the session (choices: "acceptEdits",
                                                    "auto", "bypassPermissions", "default", "dontAsk", "plan")
  --plugin-dir <path>                               Load plugins from a directory for this session only (repeatable:
                                                    --plugin-dir A --plugin-dir B) (default: [])
  -p, --print                                       Print response and exit (useful for pipes). Note: The workspace
                                                    trust dialog is skipped when Claude is run with the -p mode. Only
                                                    use this flag in directories you trust.
  --remote-control-session-name-prefix <prefix>     Prefix for auto-generated Remote Control session names (default:
                                                    hostname)
  --replay-user-messages                            Re-emit user messages from stdin back on stdout for acknowledgment
                                                    (only works with --input-format=stream-json and
                                                    --output-format=stream-json)
  -r, --resume [value]                              Resume a conversation by session ID, or open interactive picker
                                                    with optional search term
  --session-id <uuid>                               Use a specific session ID for the conversation (must be a valid
                                                    UUID)
  --setting-sources <sources>                       Comma-separated list of setting sources to load (user, project,
                                                    local).
  --settings <file-or-json>                         Path to a settings JSON file or a JSON string to load additional
                                                    settings from
  --strict-mcp-config                               Only use MCP servers from --mcp-config, ignoring all other MCP
                                                    configurations
  --system-prompt <prompt>                          System prompt to use for the session
  --tmux                                            Create a tmux session for the worktree (requires --worktree). Uses
                                                    iTerm2 native panes when available; use --tmux=classic for
                                                    traditional tmux.
  --tools <tools...>                                Specify the list of available tools from the built-in set. Use ""
                                                    to disable all tools, "default" to use all tools, or specify tool
                                                    names (e.g. "Bash,Edit,Read").
  --verbose                                         Override verbose mode setting from config
  -v, --version                                     Output the version number
  -w, --worktree [name]                             Create a new git worktree for this session (optionally specify a
                                                    name)

Commands:
  agents [options]                                  List configured agents
  auth                                              Manage authentication
  auto-mode                                         Inspect auto mode classifier configuration
  doctor                                            Check the health of your Claude Code auto-updater. Note: The
                                                    workspace trust dialog is skipped and stdio servers from .mcp.json
                                                    are spawned for health checks. Only use this command in directories
                                                    you trust.
  install [options] [target]                        Install Claude Code native build. Use [target] to specify version
                                                    (stable, latest, or specific version)
  mcp                                               Configure and manage MCP servers
  plugin|plugins                                    Manage Claude Code plugins
  setup-token                                       Set up a long-lived authentication token (requires Claude
                                                    subscription)
  update|upgrade                                    Check for updates and install if available
PS C:\Users\erolg>

Les commandes de gouvernance :


C’est‑à‑dire les commandes qui structurent, contrôlent et sécurisent une communauté, une plateforme ou un environnement IA/technique.

Comme ton document est bloqué, je ne peux pas en extraire le contenu, mais je peux te donner la liste complète des commandes de gouvernance réellement utiles, structurées pour GRCA100 / Guild4AI© / UGAIA© / AFEES©.


🧭 1. Commandes de gouvernance (niveau Communauté)

Ces commandes définissent qui fait quoi, comment, et avec quels droits.

  • set-governance-policy — Définir la politique de gouvernance
    Structure les règles : souveraineté, conformité, sécurité, rôles, escalade.

  • set-role — Attribuer un rôle
    Exemples : Administrateur, Expert IA, Responsable Audit, COMEX, REX.

  • set-permission — Définir les permissions d’un rôle
    Lecture, écriture, audit, supervision, publication, accès aux matrices.

  • create-group — Créer un groupe fonctionnel
    Exemple : 106 Gouvernance, 105 Audit Cybersécurité, 112 Matrices.

  • assign-group-owner — Nommer le responsable d’un groupe
    Garantit la traçabilité et la responsabilité.

  • set-escalation-path — Définir les circuits d’escalade
    Technique → RSSI → DPO → COMEX.


🧩 2. Commandes de gouvernance (niveau Rôles & Identités)

Pour gérer les membres, leurs droits et leur cycle de vie.

  • add-member — Ajouter un membre
  • remove-member — Retirer un membre
  • promote-member — Monter en rôle
  • demote-member — Diminuer les droits
  • audit-member — Vérifier les actions d’un membre
  • lock-account — Geler un compte en cas d’incident
  • rotate-keys — Rotation des clés / tokens / accès API

🔐 3. Commandes de gouvernance (niveau Sécurité & Conformité)

Pour la souveraineté, la conformité IA‑Act, RGPD, cybersécurité.

  • enable-logging — Activer la journalisation complète
    (Docker → Loki → Grafana → PowerShell → Excel)

  • set-data-classification — Classifier les données
    Public / Interne / Sensible / Critique.

  • set-retention-policy — Définir les durées de conservation
    Aligné RGPD + IA‑Act.

  • enable-audit-mode — Activer le mode audit
    Capture complète des flux, actions, modèles IA, prompts.

  • run-compliance-check — Vérifier la conformité
    Matrices GRCA100 / UGAIA / AFEES.

  • set-risk-level — Définir le niveau de risque IA‑Act
    Minimal / Limité / Élevé / Critique.


⚙️ 4. Commandes de gouvernance (niveau Technique & Supervision)

Pour orchestrer l’infrastructure souveraine.

  • deploy-service — Déployer un service
    Exemple : FastAPI, Presidio, Loki, Grafana.

  • restart-service — Redémarrer un composant

  • check-health — Vérifier l’état des services

  • update-container — Mettre à jour une image Docker

  • scan-vulnerabilities — Scanner les vulnérabilités

  • export-logs — Exporter les logs pour audit

  • generate-report — Générer un rapport Excel / PowerShell


📊 5. Commandes de gouvernance (niveau Flux & Reporting)

Pour piloter les flux entre groupes et produire les livrables COMEX.

  • define-workflow — Définir un workflow inter‑groupes
    Exemple : Incident → Audit → REX → COMEX.

  • map-flows — Cartographier les flux
    (Technique, gouvernance, reporting, conformité)

  • publish-dashboard — Publier un tableau de bord
    KPIs : conformité, incidents, maturité, risques IA.

  • schedule-review — Programmer une revue de gouvernance
    Hebdo / Mensuelle / COMEX.


🧱 6. Commandes de gouvernance (niveau Documentation & Traçabilité)

Pour garantir la cohérence documentaire GRCA100.

  • create-governance-record — Créer un enregistrement de gouvernance
  • update-governance-record — Mettre à jour une fiche
  • archive-record — Archiver un document
  • validate-matrix — Valider une matrice d’audit
  • publish-guideline — Publier une directive officielle

🎯 Synthèse ultra‑condensée (format COMEX)

Gouvernance = 6 blocs de commandes :

  1. Structure (rôles, groupes, permissions)
  2. Identités (membres, accès, clés)
  3. Conformité (RGPD, IA‑Act, audit)
  4. Technique (Docker, logs, supervision)
  5. Flux (workflows, reporting, dashboards)
  6. Documentation (matrices, directives, archives)


Matrice complète Commandes × Groupes × Responsables × Risques :

Elle est directement exploitable dans GRCA100 / Guild4AI© / UGAIA© / AFEES©, et structurée pour intégration immédiate dans un tableau Excel, une fiche COMEX ou une infographie A3.

Je te la donne en version premium, opérationnelle, exhaustive, avec une logique Gouvernance → Groupes → Rôles → Risques.


🧩 Matrice complète : Commandes × Groupes × Responsables × Risques

📌 Légende rapide

  • Groupe = un des 13 groupes GRCA100
  • Responsable = rôle maître du contrôle
  • Risque = risque principal si la commande est mal exécutée ou non appliquée

🧱 1. Bloc STRUCTURE (Rôles, groupes, permissions)

CommandeGroupe concernéResponsableRisques principaux
set-governance-policy106 GouvernanceResponsable GouvernanceGouvernance floue, dérives, non‑conformité IA‑Act
create-group106 GouvernanceAdmin CommunautéMauvaise segmentation, confusion des flux
set-role106 GouvernanceAdmin + GouvernanceAccès inadaptés, escalade non maîtrisée
set-permission106 GouvernanceGouvernance + RSSISur‑exposition des données, fuite d’information
assign-group-owner106 GouvernanceGouvernanceAbsence de responsabilité, zones grises
set-escalation-path106 GouvernanceGouvernance + RSSI + DPOIncidents non traités, retards, sanctions

🔐 2. Bloc IDENTITÉS & ACCÈS

CommandeGroupe concernéResponsableRisques principaux
add-memberTousAdminAjout non contrôlé, infiltration
remove-memberTousAdminAccès résiduels, comptes dormants
promote-member106 / 111GouvernanceSur‑délégation, privilèges excessifs
demote-member106GouvernanceConflits, perte de traçabilité
audit-member105 AuditRSSI + AuditActions non tracées, fraude interne
lock-account105 AuditRSSICompromission persistante
rotate-keys109 Installations TechniquesRSSI + Tech LeadClés compromises, accès illégitimes

🛡️ 3. Bloc SÉCURITÉ & CONFORMITÉ

CommandeGroupe concernéResponsableRisques principaux
enable-logging109 Installations TechniquesTech LeadAbsence de preuves, impossibilité d’audit
set-data-classification107 Réglementaire & JuridiqueDPOTraitement illégal, fuite de données
set-retention-policy107DPONon‑conformité RGPD, sanctions
enable-audit-mode105 AuditRSSI + AuditAbsence de traçabilité, IA non contrôlée
run-compliance-check112 MatricesAudit + GouvernanceNon‑conformité IA‑Act / RGPD
set-risk-level112 MatricesGouvernance + COMEXMauvaise catégorisation des systèmes IA

⚙️ 4. Bloc TECHNIQUE (Docker, API, Monitoring)

CommandeGroupe concernéResponsableRisques principaux
deploy-service109 Installations TechniquesTech LeadDéploiement instable, faille de config
restart-service109Tech LeadInterruption de service
check-health109Tech LeadDétection tardive des incidents
update-container109Tech LeadVulnérabilités non corrigées
scan-vulnerabilities105 Audit CybersécuritéRSSIExploitation de failles
export-logs105 / 109RSSI + AuditPerte de preuves, logs incomplets
generate-report111 COMEXGouvernance + AuditMauvaise décision stratégique

🔄 5. Bloc FLUX & REPORTING

CommandeGroupe concernéResponsableRisques principaux
define-workflow108 Ateliers & ConférencesGouvernanceProcessus incohérents, erreurs humaines
map-flows104 Architectures G10ArchitecteFlux non maîtrisés, fuite de données
publish-dashboard111 COMEXGouvernance + COMEXMauvaise visibilité, décisions biaisées
schedule-review106 GouvernanceGouvernanceAbsence de revue, dérive progressive

📚 6. Bloc DOCUMENTATION & TRAÇABILITÉ

CommandeGroupe concernéResponsableRisques principaux
create-governance-record103 CommunicationGouvernanceAbsence de preuve documentaire
update-governance-record103GouvernanceVersions contradictoires
archive-record103Gouvernance + DPOPerte d’historique, non‑conformité
validate-matrix112 MatricesAudit + GouvernanceMatrices non fiables
publish-guideline103 CommunicationGouvernanceMauvaise diffusion, non‑application

🎯 Synthèse COMEX (ultra‑condensée)

DomaineCommandes clésRisque majeur
Structureset-governance-policy, set-roleGouvernance faible
Identitésadd/remove-member, rotate-keysCompromission
Sécuritéenable-logging, audit-modeAbsence de preuves
Techniquedeploy-service, update-containerVulnérabilités
Fluxdefine-workflow, dashboardsMauvaise décision
Documentationvalidate-matrix, archiveNon‑conformité

Version “Audit Interne” :

C’est‑à‑dire la matrice opérationnelle, pondérée, scorable, RACI‑ready, directement exploitable dans GRCA100 / UGAIA / Guild4AI / AFEES.

C’est la version qui est a utiliser pour :

  • piloter un audit interne,
  • mesurer la maturité,
  • identifier les risques,
  • générer un plan d’action,
  • produire un reporting COMEX.

Ici la structure premium, prête à injecter dans ton Excel automatisé ou dans ton pipeline PowerShell.


🧩 Matrice “Audit Interne” – Commandes × Groupes × RACI × Risques × Scoring

📌 Colonnes standardisées (format GRCA100 Audit Interne)

Voici la structure exacte que tu vas utiliser :

  • Commande
  • Groupe
  • RACI (R = Responsable, A = Accountable, C = Consulted, I = Informed)
  • Risque principal
  • Criticité (1–5)
  • Probabilité (1–5)
  • Score Risque = Criticité × Probabilité
  • Preuves attendues
  • Actions correctives
  • Délai
  • Statut

🧱 1. Bloc STRUCTURE

CommandeGroupeRACIRisqueCrit.Prob.ScorePreuvesActions
set-governance-policy106 GouvernanceR: Gouvernance / A: COMEX / C: RSSI / I: TousGouvernance floue5315Politique validée, versionnéeFormaliser, publier, diffuser
set-role106R: GouvernanceAccès inadaptés4312Registre des rôlesRevue trimestrielle
set-permission106R: Gouvernance / C: RSSISur‑exposition5420Matrice des permissionsRéduire privilèges
assign-group-owner106R: GouvernanceAbsence de responsabilité428Nomination officielleDésigner un owner

🔐 2. Bloc IDENTITÉS & ACCÈS

CommandeGroupeRACIRisqueCrit.Prob.ScorePreuvesActions
add-memberTousR: AdminInfiltration5210Journal d’ajoutValidation double
remove-memberTousR: AdminAccès résiduels5420Registre des départsDésactivation immédiate
rotate-keys109R: RSSIClés compromises5315Preuve rotationAutomatiser rotation

🛡️ 3. Bloc SÉCURITÉ & CONFORMITÉ

CommandeGroupeRACIRisqueCrit.Prob.ScorePreuvesActions
enable-logging109R: Tech Lead / C: RSSIAbsence de preuves5420Logs Loki/GrafanaActiver logging complet
enable-audit-mode105R: AuditIA non contrôlée5315Mode audit actifActiver systématiquement
run-compliance-check112R: AuditNon‑conformité IA‑Act5315Matrices validéesRevue mensuelle

⚙️ 4. Bloc TECHNIQUE

CommandeGroupeRACIRisqueCrit.Prob.ScorePreuvesActions
deploy-service109R: Tech LeadDéploiement instable4312Logs déploiementStandardiser
update-container109R: Tech LeadVulnérabilités5420Versioning imagesMettre à jour
scan-vulnerabilities105R: RSSIExploitation de failles5315Rapport scanCorriger failles

🔄 5. Bloc FLUX & REPORTING

CommandeGroupeRACIRisqueCrit.Prob.ScorePreuvesActions
define-workflow108R: GouvernanceProcessus incohérents4312Workflow documentéNormaliser
publish-dashboard111R: GouvernanceMauvaise décision5210Dashboard publiéVérifier données

📚 6. Bloc DOCUMENTATION

CommandeGroupeRACIRisqueCrit.Prob.ScorePreuvesActions
validate-matrix112R: AuditMatrices non fiables5315Matrice validéeRevue mensuelle
archive-record103R: Gouvernance / DPOPerte d’historique428Archive versionnéeArchiver

🎯 Synthèse Audit Interne (format COMEX)

  • 3 commandes critiques (Score ≥ 20)

    • set-permission
    • remove-member
    • enable-logging
    • update-container
  • Risques majeurs

    • Sur‑exposition des données
    • Absence de preuves d’audit
    • Vulnérabilités non corrigées
    • Accès résiduels
  • Actions prioritaires

    • Revue des permissions
    • Rotation des clés
    • Activation logging complet
    • Mise à jour des conteneurs


Le mode opérationnel.


🧩 Objectif

Un script PowerShell qui :

  • définit la matrice Audit Interne (Commandes × Groupes × RACI × Risques × Scoring)
  • calcule automatiquement le Score
  • exporte en CSV ou Excel‑ready (pour ton pipeline existant)

🧾 Script PowerShell – Matrice “Audit Interne” automatisée

# ================================
# GRCA100 - Matrice Audit Interne
# Commandes × Groupes × RACI × Risques × Scoring
# Erol GIRAUDY v5 2026 avril 17
# Tests fonctionnels valides # ================================ $source = "C:\Users\xxxxx\Matrice_AuditInterne_GRCA100.csv" $clean = "C:\Users\xxxxx\Matrice_AuditInterne_GRCA100_clean.csv" $xlsx = "C:\Users\xxxxx\Matrice_AuditInterne_GRCA100.xlsx" $pdf = "C:\Users\xxxxx\Matrice_AuditInterne_GRCA100_COMEX.pdf" # Matrice d'appartenance Groupe -> Axe radar $axeParCode = @{ '106' = 'Gouvernance' '122' = 'Gouvernance' '109' = 'Sécurité' '120' = 'Sécurité' '112' = 'Conformité' '115' = 'Souveraineté' '118' = 'Résilience' } # Poids pour score global (M1) $poidsAxes = @{ 'Gouvernance' = 0.30 'Sécurité' = 0.25 'Conformité' = 0.20 'Souveraineté' = 0.15 'Résilience' = 0.10 } # ------------------------------------------------------------ # 1. Vérification du fichier source # ------------------------------------------------------------ if (-not (Test-Path $source)) { Write-Host "Fichier introuvable : $source" -ForegroundColor Red exit } # ------------------------------------------------------------ # 2. Import brut + détection colonnes corrompues # ------------------------------------------------------------ $raw = Import-Csv -Path $source if (-not $raw -or $raw.Count -eq 0) { Write-Host "Le CSV source est vide ou illisible." -ForegroundColor Red exit } $colCrit = ($raw[0].PSObject.Properties.Name | Where-Object { $_ -match "Critic" }) $colProb = ($raw[0].PSObject.Properties.Name | Where-Object { $_ -match "Prob" }) $colDelai = ($raw[0].PSObject.Properties.Name | Where-Object { $_ -match "D.l" }) # ------------------------------------------------------------ # 3. Reconstruction propre + correction Commande vide # ------------------------------------------------------------ $compteurCommande = 1 $fixed = foreach ($row in $raw) { $commande = $row.Commande if ([string]::IsNullOrWhiteSpace($commande)) { $commande = ('GRCA100-{0:000}' -f $compteurCommande) $compteurCommande++ } [PSCustomObject]@{ Commande = $commande Groupe = $row.Groupe R = $row.R A = $row.A C = $row.C I = $row.I Risque = $row.Risque Criticite = $row.$colCrit Probabilite = $row.$colProb Preuves = $row.Preuves Actions = $row.Actions Delai = if ($colDelai) { $row.$colDelai } else { $row.'Délai' } Statut = $row.Statut } } # ------------------------------------------------------------ # 4. Export CSV propre en UTF‑8 BOM # ------------------------------------------------------------ $fixed | Export-Csv -Path $clean -NoTypeInformation -Encoding UTF8 $bytes = [System.IO.File]::ReadAllBytes($clean) $bom = [byte[]](0xEF,0xBB,0xBF) [System.IO.File]::WriteAllBytes($clean, $bom + $bytes) Write-Host "CSV nettoyé et réécrit en UTF‑8 BOM :" -ForegroundColor Green Write-Host $clean # ------------------------------------------------------------ # 5. Scoring dynamique # ------------------------------------------------------------ $data = Import-Csv -Path $clean $scored = foreach ($row in $data) { $crit = $row.Criticite -as [int] $prob = $row.Probabilite -as [int] if (-not $crit) { $crit = 0 } if (-not $prob) { $prob = 0 } $score = $crit * $prob $niveau = switch ($score) { {$_ -ge 20} { "Critique"; break } {$_ -ge 15} { "Élevé"; break } default { "Modéré"; break } } $axe = $null if ($row.Groupe -and $axeParCode.ContainsKey($row.Groupe)) { $axe = $axeParCode[$row.Groupe] } [PSCustomObject]@{ Commande = $row.Commande Groupe = $row.Groupe AxeRadar = $axe R = $row.R A = $row.A C = $row.C I = $row.I Risque = $row.Risque Criticite = $crit Probabilite = $prob ScoreRisque = $score NiveauRisque = $niveau Preuves = $row.Preuves Actions = $row.Actions Delai = $row.Delai Statut = $row.Statut } } # ------------------------------------------------------------ # 6. Synthèse console # ------------------------------------------------------------ $nbCritiques = ($scored | Where-Object NiveauRisque -eq 'Critique').Count $nbEleves = ($scored | Where-Object NiveauRisque -eq 'Élevé').Count $nbModeres = ($scored | Where-Object NiveauRisque -eq 'Modéré').Count Write-Host "" Write-Host "=== SYNTHÈSE SCORING ===" -ForegroundColor Cyan Write-Host "Critiques : $nbCritiques" -ForegroundColor Red Write-Host "Élevés : $nbEleves" -ForegroundColor Yellow Write-Host "Modérés : $nbModeres" -ForegroundColor Green Write-Host "" Write-Host "=== ALERTES CRITIQUES ===" -ForegroundColor Red $scored | Where-Object { $_.ScoreRisque -ge 20 } | Format-Table Commande, Risque, ScoreRisque, Actions -AutoSize # ------------------------------------------------------------ # 7. Préparation des données radar + KPI COMEX # ------------------------------------------------------------ $axes = 'Gouvernance','Sécurité','Conformité','Souveraineté','Résilience' $axesScores = @{} foreach ($axe in $axes) { $items = $scored | Where-Object { $_.AxeRadar -eq $axe -and $_.ScoreRisque -gt 0 } if ($items.Count -gt 0) { $axesScores[$axe] = [math]::Round(($items | Measure-Object -Property ScoreRisque -Average).Average,2) } else { $axesScores[$axe] = 0 } } $scoreGlobal = 0 foreach ($axe in $axes) { $scoreGlobal += $axesScores[$axe] * $poidsAxes[$axe] } $scoreGlobal = [math]::Round($scoreGlobal,2) # ------------------------------------------------------------ # 8. Nettoyage Excel / fichiers existants # ------------------------------------------------------------ Get-Process excel -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue Start-Sleep -Milliseconds 300 if (Test-Path $xlsx) { Remove-Item $xlsx -Force; Start-Sleep -Milliseconds 200 } if (Test-Path $pdf) { Remove-Item $pdf -Force; Start-Sleep -Milliseconds 200 } # ------------------------------------------------------------ # 9. Excel : création des 3 onglets # ------------------------------------------------------------ $excel = New-Object -ComObject Excel.Application $excel.Visible = $false $excel.DisplayAlerts = $false $wb = $excel.Workbooks.Add() $wsAudit = $wb.Worksheets.Item(1) $wsAudit.Name = "AuditInterne" $wsSynth = $wb.Worksheets.Add() $wsSynth.Name = "Synthese COMEX" $wsHeat = $wb.Worksheets.Add() $wsHeat.Name = "Heatmap GRCA100" # ------------------------------------------------------------ # 10. Remplissage AuditInterne # ------------------------------------------------------------ $headers = $scored[0].PSObject.Properties.Name for ($i=0; $i -lt $headers.Count; $i++) { $wsAudit.Cells.Item(1, $i+1).Value2 = "$($headers[$i])" $wsAudit.Cells.Item(1, $i+1).Font.Bold = $true } $rowIndex = 2 foreach ($item in $scored) { $col = 1 foreach ($prop in $headers) { $wsAudit.Cells.Item($rowIndex, $col).Value2 = "$($item.$prop)" $col++ } $rowIndex++ } $wsAudit.UsedRange.EntireColumn.AutoFit() $excel.ActiveWindow.SplitRow = 1 $excel.ActiveWindow.FreezePanes = $true $colScore = ($headers.IndexOf('ScoreRisque') + 1) if ($colScore -gt 0) { $rangeScore = $wsAudit.Range( $wsAudit.Cells.Item(2, $colScore), $wsAudit.Cells.Item($rowIndex-1, $colScore) ) $fc1 = $rangeScore.FormatConditions.Add( [Microsoft.Office.Interop.Excel.XlFormatConditionType]::xlCellValue, [Microsoft.Office.Interop.Excel.XlFormatConditionOperator]::xlGreaterEqual, "20" ) $fc1.Interior.Color = 255 $fc2 = $rangeScore.FormatConditions.Add( [Microsoft.Office.Interop.Excel.XlFormatConditionType]::xlCellValue, [Microsoft.Office.Interop.Excel.XlFormatConditionOperator]::xlGreaterEqual, "15" ) $fc2.Interior.Color = 49407 $fc3 = $rangeScore.FormatConditions.Add( [Microsoft.Office.Interop.Excel.XlFormatConditionType]::xlCellValue, [Microsoft.Office.Interop.Excel.XlFormatConditionOperator]::xlLess, "15" ) $fc3.Interior.Color = 5287936 } # ------------------------------------------------------------ # 11. Synthèse COMEX : KPI + radar # ------------------------------------------------------------ $row = 1 $wsSynth.Cells.Item($row,1).Value2 = "Synthèse COMEX GRCA100" $wsSynth.Cells.Item($row,1).Font.Bold = $true $wsSynth.Cells.Item($row,1).Font.Size = 14 $row += 2 $wsSynth.Cells.Item($row,1).Value2 = "Score global de maturité" $wsSynth.Cells.Item($row,2).Value2 = "$scoreGlobal" $row++ $wsSynth.Cells.Item($row,1).Value2 = "Risques critiques" $wsSynth.Cells.Item($row,2).Value2 = "$nbCritiques" $row++ $wsSynth.Cells.Item($row,1).Value2 = "Risques élevés" $wsSynth.Cells.Item($row,2).Value2 = "$nbEleves" $row++ $wsSynth.Cells.Item($row,1).Value2 = "Risques modérés" $wsSynth.Cells.Item($row,2).Value2 = "$nbModeres" $row += 2 $wsSynth.Cells.Item($row,1).Value2 = "Axe" $wsSynth.Cells.Item($row,2).Value2 = "Score" $wsSynth.Range("A$($row):B$($row)").Font.Bold = $true $row++ $startRadarRow = $row foreach ($axe in $axes) { $wsSynth.Cells.Item($row,1).Value2 = $axe $wsSynth.Cells.Item($row,2).Value2 = "$($axesScores[$axe])" $row++ } $endRadarRow = $row-1 $wsSynth.Columns.Item("A:B").AutoFit() $chartObj = $wsSynth.Shapes.AddChart().Chart $chartObj.ChartType = 81 # xlRadar $chartRange = $wsSynth.Range("A$startRadarRow:B$endRadarRow") $chartObj.SetSourceData($chartRange) $chartObj.HasTitle = $true $chartObj.ChartTitle.Text = "Radar GRCA100 - Maturité" $chartObj.Legend.Delete() $chartObj.Parent.Left = $wsSynth.Columns.Item("D").Left $chartObj.Parent.Top = $wsSynth.Rows.Item(2).Top $chartObj.Parent.Width = 350 $chartObj.Parent.Height = 250 # ------------------------------------------------------------ # 12. Heatmap GRCA100 (version stable) # ------------------------------------------------------------ $wsHeat.Cells.Item(1,1).Value2 = "Groupe" $wsHeat.Cells.Item(1,2).Value2 = "Score moyen" $wsHeat.Cells.Item(1,3).Value2 = "Score max" $wsHeat.Range("A1:C1").Font.Bold = $true $rowH = 2 $groupes = $scored | Where-Object { $_.Groupe } | Select-Object -ExpandProperty Groupe -Unique foreach ($g in $groupes) { $items = $scored | Where-Object { $_.Groupe -eq $g -and $_.ScoreRisque -gt 0 } if ($items.Count -gt 0) { $moy = [math]::Round(($items | Measure-Object -Property ScoreRisque -Average).Average,2) $max = ($items | Measure-Object -Property ScoreRisque -Maximum).Maximum } else { $moy = 0 $max = 0 } $wsHeat.Cells.Item($rowH,1).Value2 = "$g" $wsHeat.Cells.Item($rowH,2).Value2 = "$moy" $wsHeat.Cells.Item($rowH,3).Value2 = "$max" $rowH++ } $wsHeat.UsedRange.EntireColumn.AutoFit() # Heatmap stable (sans ColorScaleCriteria) $rangeHeat = $wsHeat.Range("B2:B$($rowH-1)") if ($rowH -gt 2) { $null = $rangeHeat.FormatConditions.AddColorScale(3) } # ------------------------------------------------------------ # 13. Sauvegarde Excel + export PDF # ------------------------------------------------------------ $wb.SaveAs($xlsx, 51) $wb.ExportAsFixedFormat( 0, $pdf, 0, $true, $false, 1, 2, $false ) $wb.Close() $excel.Quit() Write-Host "" Write-Host "Excel généré avec succès :" -ForegroundColor Green Write-Host $xlsx Write-Host "PDF COMEX généré :" -ForegroundColor Green Write-Host $pdf
------------------------------------------------------------------------
Ce pipeline GRCA100 COMEX est maintenant 100% stable.
------------------------------------------------------------------------

Vision dans la console PowerShell.


Ensuite il sera disponible au format Excel et PDF.


                            Version d'un extrais au format PDF

Version Excel.


Matrice audit version finale.


--- 
 Pierre Erol GIRAUDY 

Aucun commentaire: