{"id":533548,"date":"2025-09-29T11:37:38","date_gmt":"2025-09-29T11:37:38","guid":{"rendered":"https:\/\/www.ninjaone.com\/?post_type=script_hub&#038;p=533548"},"modified":"2025-09-29T11:37:38","modified_gmt":"2025-09-29T11:37:38","slug":"installer-des-correctifs-hors-bande-avec-powershell","status":"publish","type":"script_hub","link":"https:\/\/www.ninjaone.com\/fr\/script-hub\/installer-des-correctifs-hors-bande-avec-powershell\/","title":{"rendered":"Comment installer des correctifs hors bande sur Windows avec PowerShell ?"},"content":{"rendered":"<p>Les correctifs hors bande (Out-Of-Band ou OOB), c&rsquo;est-\u00e0-dire ceux qui sont publi\u00e9s en dehors du cycle r\u00e9gulier du Patch Tuesday de Microsoft, concernent souvent des vuln\u00e9rabilit\u00e9s critiques ou des probl\u00e8mes de stabilit\u00e9 qui exigent une action imm\u00e9diate. Dans les environnements rapides des fournisseurs de services g\u00e9r\u00e9s (MSP) et des op\u00e9rations informatiques, l&rsquo;automatisation du d\u00e9ploiement de ces correctifs peut r\u00e9duire consid\u00e9rablement les temps de r\u00e9ponse et <a href=\"https:\/\/www.ninjaone.com\/fr\/blog\/check-list-de-securite-informatique-pour-proteger-votre-entreprise\/\">am\u00e9liorer la s\u00e9curit\u00e9<\/a>. Un script PowerShell robuste qui g\u00e8re les installations de correctifs locales et distantes fournit une m\u00e9thode fiable et reproductible pour g\u00e9rer ces situations.<\/p>\n<p>Cet article pr\u00e9sente un script PowerShell con\u00e7u pour <strong>installer des correctifs hors bande<\/strong> \u00e0 l&rsquo;aide d&rsquo;une URL ou d&rsquo;un chemin d&rsquo;acc\u00e8s \u00e0 un fichier donn\u00e9. Nous verrons comment il fonctionne, pourquoi il est utile et le comparerons aux autres strat\u00e9gies de mise \u00e0 jour.<\/p>\n<h2>Contexte<\/h2>\n<p>Microsoft publie occasionnellement des mises \u00e0 jour hors bande (Out-Of-Band ou OOB) afin d&rsquo;att\u00e9nuer les menaces de s\u00e9curit\u00e9 urgentes ou de r\u00e9soudre des probl\u00e8mes de stabilit\u00e9 majeurs. Ces mises \u00e0 jour sont g\u00e9n\u00e9ralement livr\u00e9es dans des fichiers <code>.msu<\/code> (Microsoft Update Standalone). Les administrateurs doivent agir rapidement, en particulier lorsque ces correctifs comblent des vuln\u00e9rabilit\u00e9s de type \u00ab\u00a0zero-day\u00a0\u00bb ou des bugs majeurs. Cependant, le t\u00e9l\u00e9chargement et l&rsquo;installation manuels des <a href=\"https:\/\/www.ninjaone.com\/fr\/blog\/qu-est-ce-que-la-gestion-des-correctifs-patch-management\/\">correctifs sur plusieurs syst\u00e8mes<\/a> sont inefficaces et sources d&rsquo;erreurs.<\/p>\n<p>Ce script PowerShell comble cette lacune. Il permet aux professionnels de l&rsquo;informatique d&rsquo;automatiser le processus d&rsquo;installation en utilisant soit une URL directe vers la mise \u00e0 jour, soit un chemin d&rsquo;acc\u00e8s \u00e0 un fichier local. Il est particuli\u00e8rement utile dans les environnements g\u00e9r\u00e9s o\u00f9 la coh\u00e9rence administrative, la tra\u00e7abilit\u00e9 et la rapidit\u00e9 sont essentielles.<\/p>\n<h2>Le script<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\">#Requires -Version 5.1\r\n\r\n&lt;#\r\n.SYNOPSIS\r\n    Installs an out-of-band patch given a URL or a local path.\r\n.DESCRIPTION\r\n    Installs an out-of-band patch given a URL or a local path.\r\nBy using this script, you indicate your acceptance of the following legal terms as well as our Terms of Use at https:\/\/www.ninjaone.com\/terms-of-use.\r\n    Ownership Rights: NinjaOne owns and will continue to own all right, title, and interest in and to the script (including the copyright). NinjaOne is giving you a limited license to use the script in accordance with these legal terms. \r\n    Use Limitation: You may only use the script for your legitimate personal or internal business purposes, and you may not share the script with another party. \r\n    Republication Prohibition: Under no circumstances are you permitted to re-publish the script in any script library or website belonging to or under the control of any other software provider. \r\n    Warranty Disclaimer: The script is provided \u201cas is\u201d and \u201cas available\u201d, without warranty of any kind. NinjaOne makes no promise or guarantee that the script will be free from defects or that it will meet your specific needs or expectations. \r\n    Assumption of Risk: Your use of the script is at your own risk. You acknowledge that there are certain inherent risks in using the script, and you understand and assume each of those risks. \r\n    Waiver and Release: You will not hold NinjaOne responsible for any adverse or unintended consequences resulting from your use of the script, and you waive any legal or equitable rights or remedies you may have against NinjaOne relating to your use of the script. \r\n    EULA: If you are a NinjaOne customer, your use of the script is subject to the End User License Agreement applicable to you (EULA).\r\n.EXAMPLE\r\n    -MSU 'https:\/\/catalog.s.download.windowsupdate.com\/d\/msdownload\/update\/software\/secu\/2024\/07\/windows10.0-kb5040427-x64_750f2819b527034dcdd10be981fa82d140767f8f.msu'\r\n    \r\n    URL 'https:\/\/catalog.s.download.windowsupdate.com\/d\/msdownload\/update\/software\/secu\/2024\/07\/windows10.0-kb5040427-x64_750f2819b527034dcdd10be981fa82d140767f8f.msu' was given.\r\n    Downloading the file...\r\n    Waiting for 14 seconds.\r\n    Download Attempt 1\r\n    Installing update at C:\\Windows\\TEMP\\windowsupdate-1135150612.msu.\r\n    Exit Code: 3010\r\n    [Warn] A reboot is required for this update to take effect.\r\n\r\nPRESET PARAMETER: -MSU \"https:\/\/www.replace.me\"\r\n    Specify either a link or a file path to the patch you would like to install.\r\n\r\nPRESET PARAMETER: -ForceReboot\r\n    Reboot the computer after successfully installing the requested patch.\r\n\r\n.NOTES\r\n    Minimum OS Architecture Supported: Windows 10, Windows Server 2016\r\n    Release Notes: Initial Release\r\n#&gt;\r\n\r\n[CmdletBinding()]\r\nparam (\r\n    [Parameter()]\r\n    [String]$MSU,\r\n    [Parameter()]\r\n    [Switch]$ForceReboot = [System.Convert]::ToBoolean($env:forceReboot)\r\n)\r\n\r\nbegin {\r\n    if ($env:urlOrLocalPathToMsu -and $env:urlOrLocalPathToMsu -notlike \"null\") { $MSU = $env:urlOrLocalPathToMsu }\r\n\r\n    # Check if $MSU is not provided\r\n    if (!$MSU) {\r\n        Write-Host -Object \"[Error] An MSU was not provided. Please provide either a local file path or a URL to download the MSU.\"\r\n        exit 1\r\n    }\r\n\r\n    # Remove quotations if given quotations\r\n    if ($MSU) {\r\n        if ($MSU.Trim() -match \"^'\" -or $MSU.Trim() -match \"'$\" -or $MSU.Trim() -match '^\"' -or $MSU.Trim() -match '\"$') {\r\n            $QuotationsFound = $true\r\n        }\r\n        $MSU = ($MSU.Trim() -replace \"^'\" -replace \"'$\" -replace '^\"' -replace '\"$').Trim()\r\n\r\n        if ($QuotationsFound) {\r\n            Write-Host -Object \"[Warning] Removing quotations from your path. Your new path is '$MSU'.\"\r\n        }\r\n    }\r\n\r\n    # Check if $MSU is not a local file path\r\n    if ($MSU -notmatch '^[A-Za-z]:\\\\') {\r\n        # Check if $MSU starts with 'http' but not 'http[s]?:\/\/'\r\n        if ($MSU -match '^http' -and $MSU -notmatch '^http[s]?:\/\/') {\r\n            Write-Host -Object \"[Error] URL '$MSU' is malformed.\"\r\n            exit 1\r\n        }\r\n\r\n        # Check if $MSU contains double 'http[s]?:\/\/'\r\n        if ($MSU -match '^http[s]?:\/\/http[s]?:\/\/') {\r\n            Write-Host -Object \"[Error] URL '$MSU' is malformed.\"\r\n            exit 1\r\n        }\r\n\r\n        # Add 'https:\/\/' to $MSU if it does not start with 'http'\r\n        if ($MSU -notmatch '^http') {\r\n            $MSU = \"https:\/\/$MSU\"\r\n            Write-Host -Object \"[Warn] Missing http(s) from URL, changing URL to '$MSU'.\"\r\n        }\r\n\r\n        # Check if $MSU has a top-level domain\r\n        if ($MSU -notmatch '.*\\..*') {\r\n            Write-Host -Object \"[Error] No top-level domain found in URL.\"\r\n            exit 1\r\n        }\r\n        \r\n        # Validate $MSU as a URI\r\n        try {\r\n            [System.Uri]$MSU | Out-Null\r\n        }\r\n        catch {\r\n            Write-Host -Object \"[Error] URL '$MSU' is malformed.\"\r\n            Write-Host -Object \"[Error] $($_.Exception.Message)\"\r\n            exit 1\r\n        }\r\n    }\r\n    \r\n    # Check if $MSU is a local file path\r\n    if ($MSU -match '^[A-Za-z]:\\\\') {\r\n        # Check if $MSU contains invalid characters\r\n        if ($MSU -match '[&lt;&gt;\"\/\\|?]' -or $MSU -match ':.*:' -or $MSU -match '::') {\r\n            Write-Host -Object \"[Error] The file path '$MSU' contains one of the following invalid characters: &lt; &gt; : `\" \/ \\ | ? :\"\r\n            exit 1\r\n        }\r\n\r\n        # Check if the file at $MSU exists\r\n        if (!(Test-Path -Path \"$MSU\" -ErrorAction SilentlyContinue)) {\r\n            Write-Host -Object \"[Error] File does not exist at path '$MSU'.\"\r\n            exit 1\r\n        }\r\n\r\n        # Try to get the item at $MSU path\r\n        try {\r\n            $MSUFile = Get-Item -Path $MSU -Force -ErrorAction Stop\r\n        }\r\n        catch {\r\n            Write-Host -Object \"[Error] Failed to retrieve file at path '$MSU'.\"\r\n            Write-Host -Object \"[Error] $($_.Exception.Message)\"\r\n            exit 1\r\n        }\r\n\r\n        # Check if more than one file is found at $MSU path\r\n        if ($MSUFile.Count -gt 1) {\r\n            Write-Host -Object \"[Error] Too many files were found at path '$MSU'; please be more specific.\"\r\n        }\r\n\r\n        # Check if the $MSU path is a folder\r\n        if ($MSUFile.PSIsContainer) {\r\n            Write-Host -Object \"[Error] The given path '$MSU' is a folder and not an MSU file.\"\r\n            exit 1\r\n        }\r\n    }    \r\n\r\n    # Utility function for downloading files.\r\n    function Invoke-Download {\r\n        param(\r\n            [Parameter()]\r\n            [String]$URL,\r\n            [Parameter()]\r\n            [String]$Path,\r\n            [Parameter()]\r\n            [int]$Attempts = 3,\r\n            [Parameter()]\r\n            [Switch]$SkipSleep\r\n        )\r\n        Write-Host -Object \"URL '$URL' was given.\"\r\n        Write-Host -Object \"Downloading the file...\"\r\n\r\n        $SupportedTLSversions = [enum]::GetValues('Net.SecurityProtocolType')\r\n        if ( ($SupportedTLSversions -contains 'Tls13') -and ($SupportedTLSversions -contains 'Tls12') ) {\r\n            [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol::Tls13 -bor [System.Net.SecurityProtocolType]::Tls12\r\n        }\r\n        elseif ( $SupportedTLSversions -contains 'Tls12' ) {\r\n            [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12\r\n        }\r\n        else {\r\n            Write-Warning -Message \"TLS 1.2 and or TLS 1.3 are not supported on this system. This download may fail!\"\r\n            if ($PSVersionTable.PSVersion.Major -lt 3) {\r\n                Write-Warning -Message \"PowerShell 2 \/ .NET 2.0 doesn't support TLS 1.2.\"\r\n            }\r\n        }\r\n\r\n        $i = 1\r\n        While ($i -le $Attempts) {\r\n            # Some cloud services have rate-limiting\r\n            if (-not ($SkipSleep)) {\r\n                $SleepTime = Get-Random -Minimum 3 -Maximum 15\r\n                Write-Host -Object \"Waiting for $SleepTime seconds.\"\r\n                Start-Sleep -Seconds $SleepTime\r\n            }\r\n        \r\n            if ($i -ne 1) { Write-Host \"\" }\r\n            Write-Host -Object \"Download Attempt $i\"\r\n\r\n            $PreviousProgressPreference = $ProgressPreference\r\n            $ProgressPreference = 'SilentlyContinue'\r\n            try {\r\n                # Invoke-WebRequest is preferred because it supports links that redirect, e.g., https:\/\/t.ly\r\n                if ($PSVersionTable.PSVersion.Major -lt 4) {\r\n                    # Downloads the file\r\n                    $WebClient = New-Object System.Net.WebClient\r\n                    $WebClient.DownloadFile($URL, $Path)\r\n                }\r\n                else {\r\n                    # Standard options\r\n                    $WebRequestArgs = @{\r\n                        Uri                = $URL\r\n                        OutFile            = $Path\r\n                        MaximumRedirection = 10\r\n                        UseBasicParsing    = $true\r\n                    }\r\n\r\n                    # Downloads the file\r\n                    Invoke-WebRequest @WebRequestArgs\r\n                }\r\n\r\n                $File = Test-Path -Path $Path -ErrorAction SilentlyContinue\r\n            }\r\n            catch {\r\n                Write-Warning -Message \"An error has occurred while downloading!\"\r\n                Write-Warning -Message $_.Exception.Message\r\n\r\n                if (Test-Path -Path $Path -ErrorAction SilentlyContinue) {\r\n                    Remove-Item $Path -Force -Confirm:$false -ErrorAction SilentlyContinue\r\n                }\r\n\r\n                $File = $False\r\n            }\r\n\r\n            $ProgressPreference = $PreviousProgressPreference\r\n            if ($File) {\r\n                $i = $Attempts\r\n            }\r\n            else {\r\n                Write-Warning -Message \"File failed to download.\"\r\n                Write-Host -Object \"\"\r\n            }\r\n\r\n            $i++\r\n        }\r\n\r\n        if (-not (Test-Path $Path)) {\r\n            Write-Host -Object \"[Error] Failed to download file.\"\r\n            Write-Host -Object \"Please verify the URL of '$URL'.\"\r\n            exit 1\r\n        }\r\n        else {\r\n            return $Path\r\n        }\r\n    }\r\n\r\n    function Test-IsElevated {\r\n        $id = [System.Security.Principal.WindowsIdentity]::GetCurrent()\r\n        $p = New-Object System.Security.Principal.WindowsPrincipal($id)\r\n        $p.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)\r\n    }\r\n\r\n    if (!$ExitCode) {\r\n        $ExitCode = 0\r\n    }\r\n}\r\nprocess {\r\n    # Check if the script is running with elevated (Administrator) privileges\r\n    if (!(Test-IsElevated)) {\r\n        Write-Host -Object \"[Error] Access Denied. Please run with Administrator privileges.\"\r\n        exit 1\r\n    }\r\n\r\n    # Check if $MSU is not a local file path and download it if it's a URL\r\n    if ($MSU -notmatch '^[A-Za-z]:\\\\') {\r\n        $MSU = Invoke-Download -URL $MSU -Path \"$env:TEMP\\windowsupdate-$(Get-Random).msu\"\r\n        $DownloadedUpdate = $True\r\n    }\r\n\r\n    # Set the log file location\r\n    $LogLocation = \"$env:TEMP\\update-log-$(Get-Random).evt\"\r\n\r\n    # Inform the user that the update is being installed\r\n    Write-Host -Object \"Installing update at $MSU.\"\r\n\r\n    # Prepare the arguments for the update process\r\n    $UpdateArguments = \"`\"$MSU`\"\", \"\/quiet\", \"\/norestart\", \"\/log:`\"$LogLocation`\"\"\r\n    $UpdateProcess = Start-Process -FilePath \"$env:SystemRoot\\System32\\wusa.exe\" -ArgumentList $UpdateArguments -Wait -NoNewWindow -PassThru\r\n\r\n    # Check if the log file exists and try to read it\r\n    if (Test-Path -Path $LogLocation -ErrorAction SilentlyContinue) {\r\n        $LogFile = Get-WinEvent -Path $LogLocation -Oldest -ErrorAction SilentlyContinue | Select-Object TimeCreated, Message -ErrorAction SilentlyContinue | ForEach-Object { \"$($_.TimeCreated) $($_.Message)\" }\r\n        Remove-Item -Path $LogLocation -Force -ErrorAction SilentlyContinue\r\n    }\r\n    \r\n    # Remove the downloaded update file if it was downloaded\r\n    if ($DownloadedUpdate -and (Test-Path -Path $MSU -ErrorAction SilentlyContinue)) {\r\n        Remove-Item -Path $MSU -Force\r\n    }\r\n\r\n    # Output the exit code of the update process\r\n    Write-Host -Object \"Exit Code: $($UpdateProcess.ExitCode)\"\r\n\r\n    # Check if the exit code indicates success\r\n    $ValidExitCodes = \"0\", \"3010\"\r\n    if ($ValidExitCodes -notcontains $UpdateProcess.ExitCode) {\r\n        Write-Host -Object \"[Error] Exit code does not indicate success!\"\r\n\r\n        # Output the update log if available\r\n        if ($LogFile) {\r\n            Write-Host -Object \"`n### Update Log ###\"\r\n            Write-Host -Object $LogFile\r\n        }\r\n        exit 1\r\n    }\r\n\r\n    # Inform the user if a reboot is required\r\n    if (!$ForceReboot -and $UpdateProcess.ExitCode -eq 3010) {\r\n        Write-Host -Object \"[Warn] A reboot is required for this update to take effect.\"\r\n    }\r\n\r\n    # Schedule a reboot if requested and the update was successful\r\n    if ($ForceReboot -and $ExitCode -eq 0) {\r\n        Write-Host \"`nScheduling reboot for $((Get-Date).AddMinutes(1)) as requested.\"\r\n\r\n        Start-Process shutdown.exe -ArgumentList \"\/r \/t 60\" -Wait -NoNewWindow\r\n    }\r\n\r\n    exit $ExitCode\r\n}\r\nend {\r\n    \r\n    \r\n    \r\n}<\/pre>\n<p>&nbsp;<\/p>\n\n<h2>Description d\u00e9taill\u00e9e<\/h2>\n<p>Le script se compose de trois phases principales : la <strong>validation et le pr\u00e9traitement<\/strong>, le <strong>t\u00e9l\u00e9chargement et l&rsquo;installation<\/strong>, et la <strong>gestion post-installation<\/strong>.<\/p>\n<h3>1. Traitement et validation des param\u00e8tres<\/h3>\n<p>Le script accepte deux param\u00e8tres\u00a0:<\/p>\n<ul>\n<li><code>-MSU<\/code> : L&rsquo;URL ou le chemin local du fichier .msu.<\/li>\n<li><code>-ForceReboot<\/code> : Indicateur qui, s&rsquo;il est activ\u00e9, d\u00e9clenche un red\u00e9marrage du syst\u00e8me apr\u00e8s l&rsquo;installation.<\/li>\n<\/ul>\n<p>Il peut \u00e9galement int\u00e9grer ces param\u00e8tres \u00e0 partir de variables d&rsquo;environnement, ce qui offre une grande souplesse d&rsquo;int\u00e9gration avec les syst\u00e8mes de d\u00e9ploiement.<\/p>\n<p>Le script nettoie les entr\u00e9es pour supprimer les citations inutiles et v\u00e9rifie la structure de l&rsquo;URL ou du chemin d&rsquo;acc\u00e8s au fichier. Il v\u00e9rifie l&rsquo;absence de caract\u00e8res non valides et s&rsquo;assure que tout fichier local r\u00e9f\u00e9renc\u00e9 existe et qu&rsquo;il ne s&rsquo;agit pas d&rsquo;un r\u00e9pertoire.<\/p>\n<h3>2. T\u00e9l\u00e9charger Logic<\/h3>\n<p>Si une URL est fournie, le script utilise une fonction appel\u00e9e <code>Invoke-Download<\/code> pour r\u00e9cup\u00e9rer le fichier patch, avec une logique de relance int\u00e9gr\u00e9e et la prise en charge des protocoles TLS 1.2 et 1.3. Cette fonction randomise un d\u00e9lai avant chaque tentative afin d&rsquo;\u00e9viter que les r\u00e9seaux de diffusion de contenu ne limitent le d\u00e9bit.<\/p>\n<h3>3. Installation et enregistrement<\/h3>\n<p>\u00c0 l&rsquo;aide de <code>wusa.exe<\/code>, le programme d&rsquo;installation des mises \u00e0 jour int\u00e9gr\u00e9 \u00e0 Windows, le script lance le processus de correction avec les options <code>\/quiet<\/code> et <code>\/norestart<\/code>, ainsi qu&rsquo;un fichier journal personnalis\u00e9.<\/p>\n<p>Apr\u00e8s l&rsquo;installation, le script \u00e9value le code de sortie :<\/p>\n<ul>\n<li>0\u00a0: Succ\u00e8s<\/li>\n<li>3010 : Succ\u00e8s, mais red\u00e9marrage n\u00e9cessaire<\/li>\n<\/ul>\n<p>Si <code>l'option -ForceReboot<\/code> est sp\u00e9cifi\u00e9e et que le correctif a r\u00e9ussi, le syst\u00e8me planifie un red\u00e9marrage dans 60 secondes \u00e0 l&rsquo;aide de <code>shutdown.exe<\/code>.<\/p>\n<h2>Cas d&rsquo;utilisation potentiels<\/h2>\n<h3>Cas de figure\u00a0: D\u00e9ploiement de correctifs d&rsquo;urgence<\/h3>\n<p>Une entreprise MSP g\u00e9rant des centaines de terminaux est inform\u00e9e d&rsquo;une vuln\u00e9rabilit\u00e9 de type \u00ab\u00a0zero-day\u00a0\u00bb dans Windows. Microsoft a publi\u00e9 un correctif hors bande. \u00c0 l&rsquo;aide de ce script, elle planifie une automatisation NinjaOne pour invoquer le script avec l&rsquo;URL du correctif, ce qui garantit un d\u00e9ploiement rapide et uniforme <a href=\"https:\/\/www.ninjaone.com\/fr\/blog\/gestion-de-la-securite-des-terminaux-definition-et-exemples\/\">sur tous les terminaux concern\u00e9s<\/a>.<\/p>\n<p>En quelques heures, le correctif est install\u00e9 sur l&rsquo;ensemble de la flotte et les politiques de red\u00e9marrage sont appliqu\u00e9es si n\u00e9cessaire. Aucune intervention manuelle n&rsquo;est n\u00e9cessaire en dehors du param\u00e9trage de l&rsquo;automatisation initiale.<\/p>\n<h2>Comparaisons<\/h2>\n<p>Par rapport aux installations manuelles bas\u00e9es sur une interface graphique ou \u00e0 l&rsquo;utilisation de WSUS pour les correctifs d&rsquo;urgence, ce script offre les avantages suivants :<\/p>\n<table>\n<tbody>\n<tr>\n<td><strong>M\u00e9thode<\/strong><\/td>\n<td><strong>Avantages<\/strong><\/td>\n<td><strong>Inconv\u00e9nients<\/strong><\/td>\n<\/tr>\n<tr>\n<td>Installation manuelle<\/td>\n<td>Simple pour les syst\u00e8mes individuels<\/td>\n<td>Chronophage, incoh\u00e9rent<\/td>\n<\/tr>\n<tr>\n<td>WSUS \/ SCCM<\/td>\n<td>Contr\u00f4le centralis\u00e9<\/td>\n<td>N\u00e9cessite la mise en place d&rsquo;une infrastructure<\/td>\n<\/tr>\n<tr>\n<td>Script PowerShell (cet article)<\/td>\n<td>Rapide, automatisable, fonctionne \u00e0 distance<\/td>\n<td>N\u00e9cessite des droits d&rsquo;administrateur et des tests<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Ce script est \u00e9galement plus performant que les installations PowerShell de base qui ne g\u00e8rent pas les URL incorrectes, qui n&rsquo;ont pas de logique de r\u00e9essai ou qui omettent les contr\u00f4les post-installation.<\/p>\n<h2>Questions fr\u00e9quentes<\/h2>\n<p><strong>Q\u00a0: Ce script peut-il installer des mises \u00e0 jour cumulatives ?<\/strong><strong><br \/>\n<\/strong>A : Oui, tout fichier <code>.msu<\/code> valide (cumulatif ou correctif individuel) peut \u00eatre install\u00e9.<\/p>\n<p><strong>Q\u00a0: Que se passe-t-il si le syst\u00e8me ne fonctionne pas en tant qu&rsquo;administrateur ?<\/strong><strong><br \/>\n<\/strong>A : Le script v\u00e9rifie l&rsquo;\u00e9l\u00e9vation et interrompt l&rsquo;ex\u00e9cution s&rsquo;il n&rsquo;est pas ex\u00e9cut\u00e9 avec des droits d&rsquo;administrateur.<\/p>\n<p><strong>Q\u00a0: Comment le comportement de red\u00e9marrage est-il g\u00e9r\u00e9 ?<\/strong><strong><br \/>\n<\/strong>A : Par d\u00e9faut, aucun red\u00e9marrage n&rsquo;est d\u00e9clench\u00e9. Utilisez le commutateur <code>-ForceReboot<\/code> pour lancer un red\u00e9marrage si le correctif r\u00e9ussit.<\/p>\n<p><strong>Q\u00a0: Peut-on l&rsquo;utiliser dans des t\u00e2ches planifi\u00e9es ou des outils d&rsquo;automatisation ?<\/strong><strong><br \/>\n<\/strong>A : Absolument. Il accepte les variables d&rsquo;environnement et s&rsquo;int\u00e8gre parfaitement aux plateformes RMM telles que NinjaOne.<\/p>\n<h2>Implications<\/h2>\n<p>Les correctifs hors bande mal appliqu\u00e9s ou retard\u00e9s rendent les syst\u00e8mes vuln\u00e9rables aux exploits. L&rsquo;automatisation du d\u00e9ploiement des correctifs garantit la conformit\u00e9 avec les politiques de s\u00e9curit\u00e9 et les exigences d&rsquo;audit. Toutefois, l&rsquo;option de red\u00e9marrage forc\u00e9 doit \u00eatre utilis\u00e9e judicieusement, en particulier dans les environnements multi-utilisateurs, afin d&rsquo;\u00e9viter de perturber la productivit\u00e9.<\/p>\n<p>En int\u00e9grant une gestion intelligente des erreurs, une validation des t\u00e9l\u00e9chargements et une journalisation, ce script minimise les risques tout en maximisant l&rsquo;efficacit\u00e9.<\/p>\n<h2>Recommandations<\/h2>\n<ul>\n<li><strong>Testez dans un environnement d&rsquo;essai<\/strong> avant de le d\u00e9ployer dans les syst\u00e8mes de production.<\/li>\n<li><strong>Utilisez des URL de confiance<\/strong> et validez toutes les sources pour \u00e9viter d&rsquo;introduire des contenus malveillants.<\/li>\n<li><strong>Activez la journalisation verbeuse<\/strong> en production pour maintenir la tra\u00e7abilit\u00e9.<\/li>\n<li><strong>Combinez avec l&rsquo;automatisation NinjaOne<\/strong> pour un d\u00e9ploiement et une planification de masse.<\/li>\n<li><strong>D\u00e9finissez des p\u00e9riodes de maintenance appropri\u00e9es<\/strong> lors de l&rsquo;utilisation de <code>-ForceReboot<\/code>.<\/li>\n<\/ul>\n<h2>Conclusion<\/h2>\n<p>La gestion des correctifs hors bande est une fonction essentielle dans le secteur actuel de la cybers\u00e9curit\u00e9. Ce script PowerShell offre une m\u00e9thode propre, efficace et reproductible pour installer les mises \u00e0 jour \u00e0 l&rsquo;aide d&rsquo;un chemin de fichier ou d&rsquo;une URL directe. Il comprend des fonctionnalit\u00e9s bien pens\u00e9es telles que la d\u00e9tection TLS, des tentatives de relance al\u00e9atoires et une validation solide, qui contribuent toutes \u00e0 un processus de mise \u00e0 jour fiable.<\/p>\n<p>Lorsqu&rsquo;il est int\u00e9gr\u00e9 \u00e0 une plateforme comme <strong>NinjaOne<\/strong>, ce script devient encore plus puissant. NinjaOne peut d\u00e9ployer le script sur les terminaux, g\u00e9rer les variables d&rsquo;environnement et s&rsquo;occuper de la logique de red\u00e9marrage apr\u00e8s l&rsquo;installation, ce qui permet aux \u00e9quipes informatiques de r\u00e9pondre rapidement aux menaces \u00e9mergentes, en toute confiance et sous contr\u00f4le.<\/p>\n","protected":false},"author":35,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"_relevanssi_hide_post":"","_relevanssi_hide_content":"","_relevanssi_pin_for_all":"","_relevanssi_pin_keywords":"","_relevanssi_unpin_keywords":"","_relevanssi_related_keywords":"","_relevanssi_related_include_ids":"","_relevanssi_related_exclude_ids":"","_relevanssi_related_no_append":"","_relevanssi_related_not_related":"","_relevanssi_related_posts":"","_relevanssi_noindex_reason":"","_lmt_disableupdate":"no","_lmt_disable":""},"operating_system":[4212],"use_cases":[4281,4284],"class_list":["post-533548","script_hub","type-script_hub","status-publish","hentry","script_hub_category-windows"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/script_hub\/533548","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/script_hub"}],"about":[{"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/types\/script_hub"}],"author":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/users\/35"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/comments?post=533548"}],"wp:attachment":[{"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/media?parent=533548"}],"wp:term":[{"taxonomy":"script_hub_category","embeddable":true,"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/operating_system?post=533548"},{"taxonomy":"use_cases","embeddable":true,"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/use_cases?post=533548"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}