{"id":390359,"date":"2024-12-11T07:39:39","date_gmt":"2024-12-11T07:39:39","guid":{"rendered":"https:\/\/www.ninjaone.com\/?post_type=script_hub&#038;p=390359"},"modified":"2024-12-11T07:39:39","modified_gmt":"2024-12-11T07:39:39","slug":"message-contextuel-image-powershell","status":"publish","type":"script_hub","link":"https:\/\/www.ninjaone.com\/fr\/script-hub\/message-contextuel-image-powershell\/","title":{"rendered":"Cr\u00e9er un message contextuel avec image \u00e0 l&rsquo;aide de PowerShell pour les notifications Windows\u00a0"},"content":{"rendered":"<p>Une communication efficace avec les utilisateurs est essentielle pour les professionnels de l&rsquo;informatique, en particulier dans les environnements de <a href=\"https:\/\/www.ninjaone.com\/fr\/quest-ce-quun-msp\">fournisseurs de services g\u00e9r\u00e9s (MSP)<\/a>. Les notifications syst\u00e8me constituent un moyen pratique d&rsquo;interagir avec les utilisateurs finaux. Ce script <a href=\"https:\/\/www.ninjaone.com\/it-hub\/endpoint-management\/what-is-powershell\/\">PowerShell<\/a> permet aux administrateurs informatiques d&rsquo;envoyer un message contextuel avec des images optionnelles, proposant ainsi une m\u00e9thode conviviale pour diffuser des mises \u00e0 jour importantes, des rappels ou des alertes. Voici un aper\u00e7u d\u00e9taill\u00e9 de ce script, de ses fonctionnalit\u00e9s et de ses applications potentielles.<\/p>\n<h2>Contexte et importance<\/h2>\n<p>Les notifications syst\u00e8me servent de ligne de communication directe entre les administrateurs informatiques et les utilisateurs, en particulier dans les environnements o\u00f9 les notifications par e-mail ou par chat risquent d&rsquo;\u00eatre manqu\u00e9es ou ignor\u00e9es. Ce script se distingue par le fait qu&rsquo;il ne se contente pas de fournir des notifications toast personnalisables, mais qu&rsquo;il permet \u00e9galement d&rsquo;inclure des images, ce qui rend les notifications visuellement attrayantes.<\/p>\n<p>Les MSP et les services informatiques utilisent souvent des outils de ce type pour am\u00e9liorer la communication avec les utilisateurs, qu&rsquo;il s&rsquo;agisse d&rsquo;annoncer une maintenance programm\u00e9e, d&rsquo;alerter les utilisateurs en cas de probl\u00e8mes critiques ou de fournir des conseils \u00e9tape par \u00e9tape. En tirant parti du syst\u00e8me de notification natif de Windows\u00a010, ce script s&rsquo;int\u00e8gre de mani\u00e8re transparente dans le flux de travail de l&rsquo;utilisateur sans n\u00e9cessiter l&rsquo;installation de logiciels suppl\u00e9mentaires.<\/p>\n<h2>Le script\u00a0:<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\">#Requires -Version 5.1\r\n\r\n&lt;#\r\n.SYNOPSIS\r\n    Sends a toast message\/notification with a hero image to the currently signed in user. Please run as the Current Logged-on User. The script defaults to not using an image if none is provided.\r\n.DESCRIPTION\r\n    Sends a toast message\/notification with a hero image to the currently signed in user. Please run as 'Current Logged on User'.\r\n    This defaults to no image in the Toast Message, but you can specify any png formatted image from a url.\r\n    You can also specify the \"ApplicationId\" to any string.\r\n    The default ApplicationId is your company name found in the NINJA_COMPANY_NAME environment variable, but will fallback to \"NinjaOne RMM\" if it happens to not be set.\r\n\r\n    The URL image should be less than 2MB in size or less than 1MB on a metered connection.\r\n\r\n    By 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\r\n.EXAMPLE\r\n    -Title \"My Title Here\" -Message \"My Message Here\"\r\n    Sends the title \"My Title Here\" and message \"My Message Here\" as a Toast message\/notification to the currently signed in user.\r\n.EXAMPLE\r\n    -Title \"My Title Here\" -Message \"My Message Here\" -ApplicationId \"MyCompany\"\r\n    Sends the title \"My Title Here\" and message \"My Message Here\" as a Toast message\/notification to the currently signed in user.\r\n        ApplicationId: Creates a registry entry for your toasts called \"MyCompany\".\r\n        PathToImageFile: Downloads a png image for the icon in the toast message\/notification.\r\n.OUTPUTS\r\n    None\r\n.NOTES\r\n    If you want to change the defaults then with in the param block.\r\n    ImagePath uses C:\\Users\\Public\\ as that is accessible by all users.\r\n    If you want to customize the application name to show your company name,\r\n        then look for $ApplicationId and change the content between the double quotes.\r\n\r\n    Minimum OS Architecture Supported: Windows 10 (IoT editions are not supported due to lack of shell)\r\n    Release Notes: Initial Release\r\n#&gt;\r\n\r\n[CmdletBinding()]\r\nparam\r\n(\r\n    [string]$Title,\r\n    [string]$Message,\r\n    [string]$ApplicationId,\r\n    [string]$PathToImageFile\r\n)\r\n\r\nbegin {\r\n    [string]$ImagePath = \"$($env:SystemDrive)\\Users\\Public\\PowerShellToastHeroImage.png\"\r\n\r\n    # Set the default ApplicationId if it's not provided. Use the Company Name if available, otherwise use the default.\r\n    $ApplicationId = if ($env:NINJA_COMPANY_NAME) { $env:NINJA_COMPANY_NAME } else { \"NinjaOne RMM\" }\r\n\r\n    Write-Host \"[Info] Using ApplicationId: $($ApplicationId -replace '\\s+','.')\"\r\n\r\n    if ($env:title -and $env:title -notlike \"null\") { $Title = $env:title }\r\n    if ($env:message -and $env:message -notlike \"null\") { $Message = $env:message }\r\n    if ($env:applicationId -and $env:applicationId -notlike \"null\") { $ApplicationId = $env:applicationId }\r\n    if ($env:pathToImageFile -and $env:pathToImageFile -notlike \"null\") { $PathToImageFile = $env:pathToImageFile }\r\n\r\n    if ([String]::IsNullOrWhiteSpace($Title)) {\r\n        Write-Host \"[Error] A Title is required.\"\r\n        exit 1\r\n    }\r\n    if ([String]::IsNullOrWhiteSpace($Message)) {\r\n        Write-Host \"[Error] A Message is required.\"\r\n        exit 1\r\n    }\r\n\r\n    if ($Title.Length -gt 64) {\r\n        Write-Host \"[Warn] The Title is longer than 64 characters. The title will be truncated by the Windows API to 64 characters.\"\r\n    }\r\n    if ($Message.Length -gt 200) {\r\n        Write-Host \"[Warn] The Message is longer than 200 characters. The message might get truncated by the Windows API.\"\r\n    }\r\n\r\n    function Test-IsSystem {\r\n        $id = [System.Security.Principal.WindowsIdentity]::GetCurrent()\r\n        return $id.Name -like \"NT AUTHORITY*\" -or $id.IsSystem\r\n    }\r\n\r\n    if (Test-IsSystem) {\r\n        Write-Host \"[Error] Please run this script as 'Current Logged on User'.\"\r\n        Exit 1\r\n    }\r\n\r\n    function Set-RegKey {\r\n        param (\r\n            $Path,\r\n            $Name,\r\n            $Value,\r\n            [ValidateSet(\"DWord\", \"QWord\", \"String\", \"ExpandedString\", \"Binary\", \"MultiString\", \"Unknown\")]\r\n            $PropertyType = \"DWord\"\r\n        )\r\n        if (-not $(Test-Path -Path $Path)) {\r\n            # Check if path does not exist and create the path\r\n            New-Item -Path $Path -Force | Out-Null\r\n        }\r\n        if ((Get-ItemProperty -Path $Path -Name $Name -ErrorAction Ignore)) {\r\n            # Update property and print out what it was changed from and changed to\r\n            $CurrentValue = (Get-ItemProperty -Path $Path -Name $Name -ErrorAction Ignore).$Name\r\n            try {\r\n                Set-ItemProperty -Path $Path -Name $Name -Value $Value -Force -Confirm:$false -ErrorAction Stop | Out-Null\r\n            }\r\n            catch {\r\n                Write-Host \"[Error] Unable to Set registry key for $Name please see below error!\"\r\n                Write-Host \"$($_.Exception.Message)\"\r\n                exit 1\r\n            }\r\n            Write-Host \"[Info] $Path\\$Name changed from:\"\r\n            Write-Host \" $CurrentValue to:\"\r\n            Write-Host \" $($(Get-ItemProperty -Path $Path -Name $Name -ErrorAction Ignore).$Name)\"\r\n        }\r\n        else {\r\n            # Create property with value\r\n            try {\r\n                New-ItemProperty -Path $Path -Name $Name -Value $Value -PropertyType $PropertyType -Force -Confirm:$false -ErrorAction Stop | Out-Null\r\n            }\r\n            catch {\r\n                Write-Host \"[Error] Unable to Set registry key for $Name please see below error!\"\r\n                Write-Host \"$($_.Exception.Message)\"\r\n                exit 1\r\n            }\r\n            Write-Host \"[Info] Set $Path\\$Name to:\"\r\n            Write-Host \" $($(Get-ItemProperty -Path $Path -Name $Name -ErrorAction Ignore).$Name)\"\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 \"[Info] Used $PathToImageFile for the image and saving to $ImagePath\"\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            # Not everything requires TLS 1.2, but we'll try anyways.\r\n            Write-Host \"[Warn] TLS 1.2 and or TLS 1.3 isn't supported on this system. This download may fail!\"\r\n            if ($PSVersionTable.PSVersion.Major -lt 3) {\r\n                Write-Host \"[Warn] 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 1 -Maximum 7\r\n                Write-Host \"[Info] Waiting for $SleepTime seconds.\"\r\n                Start-Sleep -Seconds $SleepTime\r\n            }\r\n            if ($i -ne 1) { Write-Host \"\" }\r\n            Write-Host \"[Info] 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                # Standard options\r\n                $WebRequestArgs = @{\r\n                    Uri                = $URL\r\n                    MaximumRedirection = 10\r\n                    UseBasicParsing    = $true\r\n                    OutFile            = $Path\r\n                }\r\n    \r\n                # Download The File\r\n                Invoke-WebRequest @WebRequestArgs\r\n    \r\n                $ProgressPreference = $PreviousProgressPreference\r\n                $File = Test-Path -Path $Path -ErrorAction SilentlyContinue\r\n            }\r\n            catch {\r\n                Write-Host \"[Error] An error has occurred while downloading!\"\r\n                Write-Warning $_.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            if ($File) {\r\n                $i = $Attempts\r\n            }\r\n            else {\r\n                Write-Host \"[Error] File failed to download.\"\r\n                Write-Host \"\"\r\n            }\r\n    \r\n            $i++\r\n        }\r\n    \r\n        if (-not (Test-Path $Path)) {\r\n            Write-Host \"[Error] Failed to download file!\"\r\n            exit 1\r\n        }\r\n        else {\r\n            return $Path\r\n        }\r\n    }\r\n\r\n    function Show-Notification {\r\n        [CmdletBinding()]\r\n        Param (\r\n            [string]\r\n            $ApplicationId,\r\n            [string]\r\n            $ToastTitle,\r\n            [string]\r\n            [Parameter(ValueFromPipeline)]\r\n            $ToastText\r\n        )\r\n\r\n        # Import all the needed libraries\r\n        [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] &gt; $null\r\n        [Windows.UI.Notifications.ToastNotification, Windows.UI.Notifications, ContentType = WindowsRuntime] &gt; $null\r\n        [Windows.System.User, Windows.System, ContentType = WindowsRuntime] &gt; $null\r\n        [Windows.System.UserType, Windows.System, ContentType = WindowsRuntime] &gt; $null\r\n        [Windows.System.UserAuthenticationStatus, Windows.System, ContentType = WindowsRuntime] &gt; $null\r\n        [Windows.Storage.ApplicationData, Windows.Storage, ContentType = WindowsRuntime] &gt; $null\r\n\r\n        # Make sure that we can use the toast manager, also checks if the service is running and responding\r\n        try {\r\n            $ToastNotifier = [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier(\"$ApplicationId\")\r\n        }\r\n        catch {\r\n            Write-Host \"$($_.Exception.Message)\"\r\n            Write-Host \"[Error] Failed to create notification.\"\r\n        }\r\n\r\n        # Create a new toast notification\r\n        $RawXml = [xml] @\"\r\n&lt;toast&gt;\r\n    &lt;visual&gt;\r\n    &lt;binding template='ToastGeneric'&gt;\r\n        &lt;text id='1'&gt;$ToastTitle&lt;\/text&gt;\r\n        &lt;text id='2'&gt;$ToastText&lt;\/text&gt;\r\n        $(if($PathToImageFile){\"&lt;image placement='hero' src='$ImagePath' \/&gt;\"})\r\n    &lt;\/binding&gt;\r\n    &lt;\/visual&gt;\r\n&lt;\/toast&gt;\r\n\"@\r\n\r\n        # Serialized Xml for later consumption\r\n        $SerializedXml = New-Object Windows.Data.Xml.Dom.XmlDocument\r\n        $SerializedXml.LoadXml($RawXml.OuterXml)\r\n\r\n        # Setup how are toast will act, such as expiration time\r\n        $Toast = $null\r\n        $Toast = [Windows.UI.Notifications.ToastNotification]::new($SerializedXml)\r\n        $Toast.Tag = \"PowerShell\"\r\n        $Toast.Group = \"PowerShell\"\r\n        $Toast.ExpirationTime = [DateTimeOffset]::Now.AddMinutes(1)\r\n\r\n        # Show our message to the user\r\n        $ToastNotifier.Show($Toast)\r\n    }\r\n}\r\nprocess {\r\n    Write-Host \"ApplicationID: $ApplicationId\"\r\n\r\n    if (-not $(Split-Path -Path $ImagePath -Parent | Test-Path -ErrorAction SilentlyContinue)) {\r\n        try {\r\n            New-Item \"$(Split-Path -Path $ImagePath -Parent)\" -ItemType Directory -ErrorAction Stop\r\n            Write-Host \"[Info] Created folder: $(Split-Path -Path $ImagePath -Parent)\"\r\n        }\r\n        catch {\r\n            Write-Host \"[Error] Failed to create folder: $(Split-Path -Path $ImagePath -Parent)\"\r\n            exit 1\r\n        }\r\n    }\r\n\r\n    $DownloadArguments = @{\r\n        URL  = $PathToImageFile\r\n        Path = $ImagePath\r\n    }\r\n\r\n    Set-RegKey -Path \"HKCU:\\SOFTWARE\\Classes\\AppUserModelId\\$($ApplicationId -replace '\\s+','.')\" -Name \"DisplayName\" -Value $ApplicationId -PropertyType String\r\n    if ($PathToImageFile -like \"http*\") {\r\n        Invoke-Download @DownloadArguments\r\n    }\r\n    elseif ($PathToImageFile -match \"^[a-zA-Z]:\\\\\" -and $(Test-Path -Path $PathToImageFile -ErrorAction SilentlyContinue)) {\r\n        Write-Host \"[Info] Image is a local file, copying to $ImagePath\"\r\n        try {\r\n            Copy-Item -Path $PathToImageFile -Destination $ImagePath -Force -ErrorAction Stop\r\n            Set-RegKey -Path \"HKCU:\\SOFTWARE\\Classes\\AppUserModelId\\$($ApplicationId -replace '\\s+','.')\" -Name \"IconUri\" -Value \"$ImagePath\" -PropertyType String\r\n            Write-Host \"[Info] System is ready to send Toast Messages to the currently logged on user.\"\r\n        }\r\n        catch {\r\n            Write-Host \"[Error] Failed to copy image file: $PathToImageFile\"\r\n            exit 1\r\n        }\r\n    }\r\n    elseif ($PathToImageFile -match \"^[a-zA-Z]:\\\\\" -and -not $(Test-Path -Path $PathToImageFile -ErrorAction SilentlyContinue)) {\r\n        Write-Host \"[Error] Image does not exist at $PathToImageFile\"\r\n        exit 1\r\n    }\r\n    else {\r\n        if ($PathToImageFile) {\r\n            Write-Host \"[Warn] Provided image is not a local file or a valid URL.\"\r\n        }\r\n        Write-Host \"[Info] No image will be used.\"\r\n    }\r\n\r\n    try {\r\n        Write-Host \"[Info] Attempting to send message to user...\"\r\n        $NotificationParams = @{\r\n            ToastTitle    = $Title\r\n            ToastText     = $Message\r\n            ApplicationId = \"$($ApplicationId -replace '\\s+','.')\"\r\n        }\r\n        Show-Notification @NotificationParams -ErrorAction Stop\r\n        Write-Host \"[Info] Message sent to user.\"\r\n    }\r\n    catch {\r\n        Write-Host \"[Error] Failed to send message to user.\"\r\n        Write-Host \"$($_.Exception.Message)\"\r\n        exit 1\r\n    }\r\n    exit 0\r\n}\r\nend {\r\n    \r\n    \r\n    \r\n}<\/pre>\n<p>&nbsp;<\/p>\n\n<div class=\"in-context-cta\"><p>Gagnez du temps gr\u00e2ce \u00e0 plus de 300 scripts du Dojo NinjaOne.<\/p>\n<p>\u2192 <a class=\"waffle-rich-text-link\" href=\"https:\/\/www.ninjaone.com\/fr\/phase-de-test-gratuit\/\">Obtenir l&rsquo;acc\u00e8s<\/a><\/p>\n<\/div>\n<h2>Description d\u00e9taill\u00e9e du script<\/h2>\n<p>Ce script PowerShell est con\u00e7u pour \u00eatre ex\u00e9cut\u00e9 par l&rsquo;utilisateur actuellement connect\u00e9. Voici une explication \u00e9tape par \u00e9tape de son d\u00e9roulement\u00a0:<\/p>\n<h3>1. Param\u00e8tres et r\u00e9glages par d\u00e9faut<\/h3>\n<p>a. Le script accepte des param\u00e8tres pour le titre, le message, l&rsquo;ID de l&rsquo;application et un chemin d&rsquo;acc\u00e8s facultatif \u00e0 un fichier image.<\/p>\n<p>b. Si l&rsquo;ID de l&rsquo;application n&rsquo;est pas sp\u00e9cifi\u00e9, le script prend par d\u00e9faut le nom de la soci\u00e9t\u00e9 stock\u00e9 dans la variable d&rsquo;environnement NINJA_COMPANY_NAME ou revient \u00e0 \u00ab\u00a0NinjaOne RMM.\u00a0\u00bb<\/p>\n<p>c. Si aucune image n&rsquo;est fournie, la notification s&rsquo;affichera sans image.<\/p>\n<h3>2. Validation de l&rsquo;environnement<\/h3>\n<p>a. Le script v\u00e9rifie s&rsquo;il est ex\u00e9cut\u00e9 en tant qu&rsquo;utilisateur connect\u00e9. Si ce n&rsquo;est pas le cas, il se termine avec une erreur.<\/p>\n<h3>3. Gestion du registre<\/h3>\n<p>a. Le script utilise une fonction d&rsquo;aide pour cr\u00e9er ou mettre \u00e0 jour les cl\u00e9s de registre pour le nom d&rsquo;affichage de l&rsquo;application et l&rsquo;ic\u00f4ne optionnelle. Cela permet de garantir une attribution et une personnalisation correctes pour les notifications.<\/p>\n<h3>4. Traitement des images<\/h3>\n<p>a. Le script peut t\u00e9l\u00e9charger une image \u00e0 partir d&rsquo;une URL ou utiliser un fichier local. Il garantit que l&rsquo;image est sauvegard\u00e9e dans un dossier public pour en faciliter l&rsquo;acc\u00e8s.<\/p>\n<p>b. Si aucune image valide n&rsquo;est fournie, le script se poursuit sans image.<\/p>\n<h3>5. Cr\u00e9ation d&rsquo;une notification<\/h3>\n<p>a. En utilisant les API de Windows, le script construit et affiche une notification toast.<\/p>\n<p>b. La notification comprend le titre et le message sp\u00e9cifi\u00e9s et inclut l&rsquo;image si elle est fournie.<\/p>\n<h3>6. Gestion des erreurs<\/h3>\n<p>a. Le script comporte une gestion efficace des erreurs, y compris des avertissements pour les configurations non prises en charge, les \u00e9checs de t\u00e9l\u00e9chargement et les param\u00e8tres manquants.<\/p>\n<h2>Cas d&rsquo;utilisation potentiels<\/h2>\n<h3>\u00c9tude de cas\u00a0: Annonce de maintenance informatique<\/h3>\n<p>Un administrateur informatique g\u00e9rant un r\u00e9seau d&rsquo;entreprise doit informer les utilisateurs de la maintenance pr\u00e9vue. \u00c0 l&rsquo;aide de ce script, l&rsquo;administrateur envoie une notification toast avec les d\u00e9tails suivants\u00a0:<\/p>\n<ul>\n<li><strong>Titre<\/strong>\u00a0: \u00ab\u00a0Maintenance programm\u00e9e \u00e0 22\u00a0heures\u00a0\u00bb<\/li>\n<li><strong>Message<\/strong>\u00a0: \u00ab\u00a0Veuillez sauvegarder votre travail. Les syst\u00e8mes seront interrompus pendant deux heures \u00e0 partir de 22\u00a0heures\u00a0\u00bb<\/li>\n<li><strong>Image<\/strong>\u00a0: Un logo d&rsquo;entreprise h\u00e9berg\u00e9 sur une URL publique.<\/li>\n<\/ul>\n<p>Cette approche garantit que les utilisateurs re\u00e7oivent un message clair et au logo de l&rsquo;entreprise directement sur leur bureau.<\/p>\n<h2>Comparaisons avec d&rsquo;autres m\u00e9thodes<\/h2>\n<h3>Outils de notification int\u00e9gr\u00e9s<\/h3>\n<p>Bien que Windows dispose de fonctions de notification int\u00e9gr\u00e9es, celles-ci n\u00e9cessitent souvent une configuration complexe ou un logiciel tiers. Ce script simplifie le processus et offre davantage de possibilit\u00e9s de personnalisation.<\/p>\n<h3>Solutions logicielles personnalis\u00e9es<\/h3>\n<p>Les logiciels de notification personnalis\u00e9s peuvent offrir des fonctionnalit\u00e9s similaires, mais \u00e0 un co\u00fbt plus \u00e9lev\u00e9. Ce script propose une alternative l\u00e9g\u00e8re et rentable, con\u00e7ue pour les professionnels qui ma\u00eetrisent PowerShell.<\/p>\n<h2>Questions fr\u00e9quemment pos\u00e9es<\/h2>\n<ol>\n<li><strong>Puis-je utiliser ce script sur Windows\u00a07 ou des versions ant\u00e9rieures\u00a0?<\/strong><br \/>\nNon, le script est con\u00e7u pour Windows 10 et les versions ult\u00e9rieures en raison de sa d\u00e9pendance aux API Windows modernes.<\/li>\n<li><strong>Quels sont les formats d&rsquo;image compatibles\u00a0?<\/strong><br \/>\nLe script prend en charge les fichiers .png. Veillez \u00e0 ce que la taille du fichier soit inf\u00e9rieure \u00e0 2 Mo pour des performances optimales.<\/li>\n<li><strong>Est-il possible d&rsquo;automatiser ce script pour plusieurs utilisateurs\u00a0?<\/strong><br \/>\nOui, vous pouvez int\u00e9grer ce script dans un cadre d&rsquo;automatisation plus large, mais il doit \u00eatre ex\u00e9cut\u00e9 dans le contexte de chaque utilisateur connect\u00e9.<\/li>\n<\/ol>\n<h2>Ce qu&rsquo;implique l&rsquo;utilisation de ce script<\/h2>\n<p>Le d\u00e9ploiement de notifications accompagn\u00e9es d&rsquo;images am\u00e9liore l&rsquo;engagement des utilisateurs et garantit que les informations essentielles sont vues. Toutefois, les administrateurs doivent faire preuve de prudence afin d&rsquo;\u00e9viter une utilisation excessive, qui pourrait entra\u00eener une lassitude face aux notifications. De plus, ce script souligne l&rsquo;importance de canaux de communication s\u00fbrs et efficaces dans les op\u00e9rations informatiques.<\/p>\n<h2>Bonnes pratiques lors de l&rsquo;utilisation de ce script<\/h2>\n<ol>\n<li><strong>Personnalisez les notifications<\/strong><br \/>\nAdaptez le titre et le message pour garantir la pertinence et la clart\u00e9 pour l&rsquo;utilisateur final.<\/li>\n<li><strong>Utilisez des images compress\u00e9es<\/strong><br \/>\nOptimisez les images pour r\u00e9duire la taille des fichiers et garantir un chargement rapide, en particulier sur les connexions limit\u00e9es.<\/li>\n<li><strong>Testez la notification dans un environnement contr\u00f4l\u00e9<\/strong><br \/>\nAvant de proc\u00e9der \u00e0 un d\u00e9ploiement \u00e0 grande \u00e9chelle, testez le script pour vous assurer de sa compatibilit\u00e9 et de son efficacit\u00e9.<\/li>\n<li><strong>Maintenez un registre propre<\/strong><br \/>\nExaminez r\u00e9guli\u00e8rement les entr\u00e9es de registre cr\u00e9\u00e9es par le script pour \u00e9viter l&rsquo;encombrement.<\/li>\n<\/ol>\n<h2>Conclusion<\/h2>\n<p>PowerShell reste un outil polyvalent pour les professionnels de l&rsquo;informatique, et ce script illustre son potentiel en mati\u00e8re de simplification de la communication avec les utilisateurs. <a href=\"https:\/\/www.ninjaone.com\/fr\/\">NinjaOne<\/a> compl\u00e8te ce type d&rsquo;outils en proposant une suite efficace de solutions de gestion informatique, permettant aux MSP et aux d\u00e9partements informatiques de fournir une assistance pertinente et transparente. Que vous soyez un administrateur informatique ou un MSP, l&rsquo;int\u00e9gration de ces scripts dans votre flux de travail peut consid\u00e9rablement am\u00e9liorer votre <a href=\"https:\/\/www.ninjaone.com\/fr\/efficacite\/\">efficacit\u00e9<\/a> op\u00e9rationnelle et la satisfaction utilisateur.<\/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":[4289],"class_list":["post-390359","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\/390359","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=390359"}],"wp:attachment":[{"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/media?parent=390359"}],"wp:term":[{"taxonomy":"script_hub_category","embeddable":true,"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/operating_system?post=390359"},{"taxonomy":"use_cases","embeddable":true,"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/use_cases?post=390359"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}