{"id":353667,"date":"2024-08-27T15:58:07","date_gmt":"2024-08-27T15:58:07","guid":{"rendered":"https:\/\/www.ninjaone.com\/script-hub\/creer-des-raccourcis-sur-le-bureau-powershell\/"},"modified":"2024-10-13T19:09:52","modified_gmt":"2024-10-13T19:09:52","slug":"creer-des-raccourcis-sur-le-bureau-powershell","status":"publish","type":"script_hub","link":"https:\/\/www.ninjaone.com\/fr\/script-hub\/creer-des-raccourcis-sur-le-bureau-powershell\/","title":{"rendered":"Comment cr\u00e9er des raccourcis sur le bureau avec PowerShell : le guide \u00e9tape par \u00e9tape"},"content":{"rendered":"<p>La <strong>cr\u00e9ation de raccourcis de bureau<\/strong> de fa\u00e7on programm\u00e9e peut faire gagner beaucoup de temps et d&rsquo;efforts aux professionnels de l&rsquo;informatique, en particulier lorsqu&rsquo;ils g\u00e8rent des environnements \u00e0 utilisateurs multiples. <a href=\"https:\/\/www.ninjaone.com\/it-hub\/endpoint-management\/what-is-powershell\/\" target=\"_blank\" rel=\"noopener\">PowerShell<\/a>, un puissant langage de script natif de Windows, offre la flexibilit\u00e9 et la fonctionnalit\u00e9 n\u00e9cessaires pour automatiser efficacement cette t\u00e2che.<\/p>\n<p>Ce billet de blog se penche sur un script PowerShell complet con\u00e7u pour cr\u00e9er des raccourcis de bureau pour les ex\u00e9cutables, en d\u00e9taillant son utilisation, ses fonctionnalit\u00e9s et ses avantages pour les professionnels de l&rsquo;informatique et les <a href=\"https:\/\/www.ninjaone.com\/fr\/quest-ce-quun-msp\" target=\"_blank\" rel=\"noopener\">fournisseurs de services g\u00e9r\u00e9s (MSP).<\/a><\/p>\n<h2>Contexte<\/h2>\n<p>Dans les grands environnements informatiques, la gestion des postes de travail des utilisateurs et la garantie d&rsquo;une uniformit\u00e9 entre tous les syst\u00e8mes peuvent constituer un d\u00e9fi. Les raccourcis du bureau sont un \u00e9l\u00e9ment simple mais essentiel de cette gestion, car ils permettent d&rsquo;acc\u00e9der rapidement aux applications, aux sites web et aux fichiers.<\/p>\n<p>La cr\u00e9ation manuelle de ces raccourcis pour chaque utilisateur n&rsquo;est pas possible, en particulier dans les entreprises comptant de nombreux utilisateurs. C&rsquo;est l\u00e0 que l&rsquo;automatisation \u00e0 l&rsquo;aide de scripts PowerShell devient inestimable. Le script en question ne se contente pas de cr\u00e9er des raccourcis, il permet \u00e9galement de les personnaliser \u00e0 l&rsquo;aide de param\u00e8tres tels que les chemins d&rsquo;acc\u00e8s aux ic\u00f4nes, les arguments ex\u00e9cutables et les param\u00e8tres sp\u00e9cifiques \u00e0 l&rsquo;utilisateur.<\/p>\n<h2>Le script<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\">&lt;#\r\n.SYNOPSIS\r\n    This script creates a desktop shortcut for an executable with specified options. It can create a shortcut for all users (including new ones) or for existing users only.\r\n.DESCRIPTION\r\n    This script creates a desktop shortcut for an executable with specified options. \r\n    It can create a shortcut for all users (including new ones) or for existing users only.\r\n\r\n    You can also provide a base64 string on line 79 enclosed in quotes and an icon directory, and the script will use that instead.\r\n.EXAMPLE\r\n    This will create a shortcut that opens www.google.com in Firefox on JohnSmith's desktop. This is not limited to just browsers; you can specify any executable you would normally be able to via the \"Create Shortcut\" menu.\r\n    \r\n    -Name \"ERP App\" -EXEPath \"C:\\Program Files\\Mozilla Firefox\\firefox.exe\" -StartIn \"C:\\Program Files\\Mozilla Firefox\" -IconPath \"C:\\ProgramData\\ERPapp\\customicon.ico\" -Arguments \"https:\/\/www.google.com\" -User \"JohnSmith\"\r\n\r\n    Creating Shortcut at C:\\Users\\JohnSmith\\Desktop\\ERP App.lnk\r\n\r\n.PARAMETER NAME\r\n    The name of the shortcut, e.g., \"Login Portal\".\r\n\r\n.PARAMETER ExePath\r\n    The target field in the shortcut, excluding arguments.\r\n\r\n.PARAMETER Arguments\r\n    The arguments for the executable inside the shortcut.\r\n\r\n.PARAMETER StartIn\r\n    Some executables require that they be opened in a specific directory.\r\n\r\n.PARAMETER Icon\r\n    The path to an image file to use for the shortcut. You could also place the base64 string on line 79 and specify an IconDirectory with the below parameter.\r\n\r\n.PARAMETER IconDirectory\r\n    Path to store the .ico file to use for the shortcut.\r\n\r\n.PARAMETER IconURL\r\n    A link to an image file you would like to use for the shortcut. You could also place the base64 string on line 79 and specify an IconDirectory using '-IconDirectory'.\r\n\r\n.PARAMETER AllExistingUsers\r\n    Creates the shortcut for all existing users but not for new users, e.g., C:\\Users\\*\\Desktop\\shortcut.lnk.\r\n\r\n.PARAMETER AllUsers\r\n    Creates the shortcut in C:\\Users\\Public\\Desktop.\r\n\r\n.OUTPUTS\r\n    None\r\n.NOTES\r\n    Minimum OS Architecture Supported: Windows 7, Windows Server 2008\r\n    Release Notes: Split the script into three separate scripts, added script variable support, and improved icon support.\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#&gt;\r\n\r\n[CmdletBinding()]\r\nparam (\r\n    [Parameter()]\r\n    [String]$Name,\r\n    [Parameter()]\r\n    [String]$ExePath,\r\n    [Parameter()]\r\n    [String]$Arguments,\r\n    [Parameter()]\r\n    [String]$StartIn,\r\n    [Parameter()]\r\n    [String]$Icon,\r\n    [Parameter()]\r\n    [String]$IconDirectory,\r\n    [Parameter()]\r\n    [String]$IconUrl,\r\n    [Parameter()]\r\n    [Switch]$AllExistingUsers,\r\n    [Parameter()]\r\n    [String]$ExcludeUsers,\r\n    [Parameter()]\r\n    [Switch]$AllUsers\r\n)\r\n\r\nbegin {\r\n    Add-Type -AssemblyName System.Drawing\r\n\r\n    # If the line below is replaced with $IconBase64 = 'YourBase64EncodedImageInQuotes', the script will decode it and use it for the desktop shortcut. Be sure to provide an Icon Storage Directory.\r\n    $IconBase64 = $null\r\n\r\n    # Replace existing parameters with Form Variables if used.\r\n    if ($env:shortcutName -and $env:shortcutName -notlike \"null\") { $Name = $env:shortcutName }\r\n    if ($env:createTheShortcutFor -and $env:createTheShortcutFor -notlike \"null\") { \r\n        if ($env:createTheShortcutFor -eq \"All Users\") { $AllUsers = $True }\r\n        if ($env:createTheShortcutFor -eq \"All Existing Users\") { $AllExistingUsers = $True }\r\n    }\r\n    if ($env:exePath -and $env:exePath -notlike \"null\") { $ExePath = $env:exePath }\r\n    if ($env:exeArguments -and $env:exeArguments -notlike \"null\") { $Arguments = $env:exeArguments }\r\n    if ($env:exeShouldStartIn -and $env:exeShouldStartIn -notlike \"null\") { $StartIn = $env:exeShouldStartIn }\r\n    if ($env:linkToIconFile -and $env:linkToIconFile -notlike \"null\") { $IconUrl = $env:linkToIconFile }\r\n    if ($env:iconStorageDirectory -and $env:iconStorageDirectory -notlike \"null\") { $IconDirectory = $env:iconStorageDirectory }\r\n\r\n    # Ensure a user is specified for shortcut creation.\r\n    if (-not $AllUsers -and -not $AllExistingUsers -and -not $User) {\r\n        Write-Host \"[Error] You must specify which desktop to create the shortcut on!\"\r\n        exit 1\r\n    }\r\n\r\n    $invalidFileNames = '[&lt;&gt;:\"\/\\\\|?*\\x00-\\x1F]|\\.$|\\s$'\r\n    if ($Name -match $invalidFileNames) {\r\n        Write-Host '[Error] The name you specified contains one of the following invalid characters or ends with a period. &lt;&gt;:\"\/\\|?*'\r\n        exit 1\r\n    }\r\n\r\n    $ExitCode = 0\r\n    \r\n    # Icons are secondary. If no information is given, continue without them, but notify the technician.\r\n    if (($Icon -or $IconUrl) -and -not $IconDirectory) {\r\n        Write-Warning \"An icon was provided, but no storage location was specified. Use the Icon Storage Directory parameter to specify a directory to store it. (You may want this directory to be accessible by all users.)\"\r\n        Write-Warning \"Ignoring supplied icon info.\"\r\n        $ExitCode = 1\r\n        $Icon = $null\r\n        $IconUrl = $null\r\n    }\r\n\r\n    if ($Icon) {\r\n        $FileName = Split-Path $Icon -Leaf\r\n\r\n        # Check for valid icon formats. Only support .png, .jpg, .jpeg, .ico, and .gif.\r\n        if ($FileName -notmatch '\\.bmp$' -and $FileName -notmatch '\\.png$' -and $FileName -notmatch '\\.jpg$' -and $FileName -notmatch '\\.jpeg$' -and $FileName -notmatch '.ico$' -and $FileName -notmatch '.gif$') {\r\n            Write-Warning \"Your icon is in an invalid format. Only .png, .jpg, .jpeg, .ico, and .gif formats are supported. Switching to the default icon. You can re-run the script to replace the icon.\"\r\n            $Icon = $null\r\n        }\r\n\r\n        if (-not (Test-Path $Icon -ErrorAction SilentlyContinue)) {\r\n            Write-Warning \"It looks like your icon is missing. Skipping for now; re-run the script with a valid path to add the icon.\"\r\n            $Icon = $null\r\n        }\r\n    }\r\n\r\n    # Create the directory for the icon if it doesn't exist.\r\n    if ($IconDirectory -and -not (Test-Path $IconDirectory -ErrorAction SilentlyContinue)) {\r\n        New-Item -ItemType Directory -Path $IconDirectory | Out-Null\r\n    }\r\n\r\n    # For PowerShell 2.0 and 3.0 compatibility we're going to need to create a Get-FileHash function\r\n    if ($PSVersionTable.PSVersion.Major -lt 4) {\r\n        function Get-FileHash {\r\n            param (\r\n                [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]\r\n                [string[]]$Path,\r\n                [Parameter(Mandatory = $false)]\r\n                [ValidateSet(\"SHA1\", \"SHA256\", \"SHA384\", \"SHA512\", \"MD5\")]\r\n                [string]$Algorithm = \"SHA256\"\r\n            )\r\n            $Path | ForEach-Object {\r\n                # Only hash files that exist\r\n                $CurrentPath = $_\r\n                if ($(Test-Path -Path $CurrentPath -ErrorAction SilentlyContinue)) {\r\n                \r\n                    $HashAlgorithm = [System.Security.Cryptography.HashAlgorithm]::Create($Algorithm)\r\n                    $Hash = [System.BitConverter]::ToString($hashAlgorithm.ComputeHash([System.IO.File]::ReadAllBytes($CurrentPath)))\r\n                    @{\r\n                        Algorithm = $Algorithm\r\n                        Path      = $Path\r\n                        Hash      = $Hash.Replace('-', '')\r\n                    }\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    # Convert a Base64 string to a file.\r\n    function ConvertFrom-Base64 {\r\n        param(\r\n            $Base64,\r\n            $Path\r\n        )\r\n        $bytes = [Convert]::FromBase64String($Base64)\r\n\r\n        [IO.File]::WriteAllBytes($Path, $bytes)\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]$BaseName,\r\n            [Parameter()]\r\n            [int]$Attempts = 3,\r\n            [Parameter()]\r\n            [Switch]$SkipSleep\r\n        )\r\n\r\n        # In case 'https:\/\/' is omitted from the URL.\r\n        if ($URL -notmatch \"^http(s)?:\/\/\") {\r\n            Write-Warning \"http(s):\/\/ is required to download the file. Adding https:\/\/ to your input....\"\r\n            $URL = \"https:\/\/$URL\"\r\n            Write-Warning \"New Url $URL.\"\r\n        }\r\n    \r\n        Write-Host \"Downloading using $URL\"\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-Warning \"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-Warning \"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 \"Waiting for $SleepTime seconds.\"\r\n                Start-Sleep -Seconds $SleepTime\r\n            }\r\n            if ($i -ne 1) { Write-Host \"\" }\r\n            Write-Host \"Download Attempt $i\"\r\n\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                    # Figures out the type of file\r\n                    $WebClient = New-Object System.Net.WebClient\r\n                    $Response = $WebClient.OpenRead($Url)\r\n                    $MimeType = $WebClient.ResponseHeaders[\"Content-Type\"]\r\n                    $DesiredExtension = switch -regex ($MimeType) {\r\n                        \"image\/jpeg|image\/jpg\" { \"jpg\" }\r\n                        \"image\/png\" { \"png\" }\r\n                        \"image\/gif\" { \"gif\" }\r\n                        \"image\/bmp|image\/x-windows-bmp|image\/x-bmp\" { \"bmp\" }\r\n                        \"image\/x-icon|image\/vnd.microsoft.icon|application\/ico\" { \"ico\" }\r\n                        default { \r\n                            throw \"[Error] The URL you provided does not provide a supported image type. Image Types Supported: jpg, jpeg, ico, bmp, png and gif. Image Type detected: $MimeType\"\r\n                        }\r\n                    }\r\n                    # Downloads the file preserving the extension\r\n                    $Path = \"$BaseName.$DesiredExtension\"\r\n                    $WebClient.DownloadFile($URL, $Path)\r\n                }\r\n                else {\r\n                    # Standard options\r\n                    $WebRequestArgs = @{\r\n                        Uri                = $URL\r\n                        MaximumRedirection = 10\r\n                        UseBasicParsing    = $true\r\n                        Method             = \"GET\"\r\n                    }\r\n\r\n                    # Figures out the type of file\r\n                    $Response = Invoke-WebRequest @WebRequestArgs\r\n                    $MimeType = $Response.Headers.'Content-Type'\r\n                    $DesiredExtension = switch -regex ($MimeType) {\r\n                        \"image\/jpeg|image\/jpg\" { \"jpg\" }\r\n                        \"image\/png\" { \"png\" }\r\n                        \"image\/gif\" { \"gif\" }\r\n                        \"image\/bmp|image\/x-windows-bmp|image\/x-bmp\" { \"bmp\" }\r\n                        \"image\/x-icon|image\/vnd.microsoft.icon|application\/ico\" { \"ico\" }\r\n                        default { \r\n                            throw \"[Error] The URL you provided does not provide a supported image type. Image Types Supported: jpg, jpeg, ico, bmp, png and gif. Image Type detected: $MimeType\"\r\n                        }\r\n                    }\r\n                    # Define the path for saving the file\r\n                    $Path = \"$BaseName.$DesiredExtension\"\r\n\r\n                    # Save the content to the file\r\n                    $Response.Content | Set-Content -Path $Path -Encoding Byte\r\n                }\r\n\r\n                $File = Test-Path -Path $Path -ErrorAction SilentlyContinue\r\n            }\r\n            catch {\r\n                Write-Warning \"An error has occurred while downloading!\"\r\n                Write-Warning $_.Exception.Message\r\n                $_\r\n\r\n                if ($Path -and (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-Warning \"File failed to download. Check the link\/URL and ensure it is correct, please note Ninja may have stripped out the following characters '&amp;|;$&gt;&lt;`!' from the link\/URL.\"\r\n                Write-Host \"\"\r\n            }\r\n\r\n            $i++\r\n        }\r\n\r\n        if ($Path -and -not (Test-Path $Path)) {\r\n            Write-Warning \"Failed to download file!\"\r\n        }\r\n        else {\r\n            return $Path\r\n        }\r\n    }\r\n\r\n    # Convert an image to an icon file. This method creates a png and then forms an ico file by appending the png's binary.\r\n    function ConvertFrom-Image {\r\n        param(\r\n            $ImagePath,\r\n            $Path\r\n        )\r\n\r\n        # Grab an instance of the image and blank bitmap\r\n        try {\r\n            $image = [Drawing.Image]::FromFile($ImagePath)\r\n        }\r\n        catch [System.OutOfMemoryException] {\r\n            Write-Host \"[Error] Loading Image file is either an unsupported file, or to large to process.\"\r\n            return\r\n        }\r\n        catch {\r\n            Write-Host \"[Error] $($_.Message)\"\r\n            return\r\n        }\r\n\r\n        # Resize the image to 255px by 255px while maintaining quality.\r\n        # If you want transparency, you'll need an Alpha channel in the pixel format.\r\n        $bitmap = New-Object System.Drawing.Bitmap (255, 255, [system.drawing.imaging.PixelFormat]::Format32bppArgb)\r\n        $bitmap.SetResolution(255, 255)\r\n\r\n        # Create a graphics object which will be used to resize the image to 255px by 255px\r\n        $graphics = [System.Drawing.Graphics]::FromImage($bitmap)\r\n\r\n        # Set some quality settings for the resize operation\r\n        $graphics.SmoothingMode = [System.Drawing.Drawing2D.SmoothingMode]::HighQuality\r\n        $graphics.InterpolationMode = [System.Drawing.Drawing2D.InterpolationMode]::HighQualityBicubic\r\n        $graphics.PixelOffsetMode = [System.Drawing.Drawing2D.PixelOffsetMode]::HighQuality\r\n\r\n        # Draw the image onto the bitmap\r\n        $graphics.DrawImage($Image, 0, 0, 255, 255)\r\n        \r\n        # Temporarily save the image as a png\r\n        $RandomNumber = Get-Random -Maximum 1000000\r\n        $bitmap.Save(\"$env:TEMP\\image-$RandomNumber.png\", [System.Drawing.Imaging.ImageFormat]::Png)\r\n        $png = \"$env:TEMP\\image-$RandomNumber.png\"\r\n\r\n        # Build the ico file using the png binary.\r\n        if ($PSVersionTable.PSVersion.Major -gt 5) {\r\n            $pngBytes = Get-Content -Path $png -AsByteStream\r\n        }\r\n        elseif ($PSVersionTable.PSVersion.Major -gt 2) {\r\n            $pngBytes = Get-Content -Path $png -Encoding Byte -Raw\r\n        }\r\n        else {\r\n            $pngBytes = [System.IO.File]::ReadAllBytes($png)\r\n        }\r\n        $icoHeader = [byte[]] @(0, 0, 1, 0, 1, 0)\r\n        $imageDataSize = $pngBytes.Length\r\n        $icoDirectory = [byte[]] @(\r\n            255, 255, # icon size\r\n            0, 0, # color count\r\n            0, 0, # reserved\r\n            0, 0, # hotspot x, hotspot y\r\n            ($imageDataSize -band 0xFF),\r\n            ([Math]::Floor($imageDataSize \/ [Math]::Pow(2, 8)) -band 0xFF),\r\n            ([Math]::Floor($imageDataSize \/ [Math]::Pow(2, 16)) -band 0xFF),\r\n            ([Math]::Floor($imageDataSize \/ [Math]::Pow(2, 24)) -band 0xFF),\r\n            22, 0, 0, 0  # offset to image data\r\n        )\r\n        $iconData = $icoHeader + $icoDirectory + $pngBytes\r\n\r\n        # Save the completed icon file and clean up any temporary files.\r\n        if (Test-Path $Path -ErrorAction SilentlyContinue) { Remove-Item $Path -Force }\r\n        [System.IO.File]::WriteAllBytes($Path, $iconData)\r\n\r\n        if (Test-Path $png -ErrorAction SilentlyContinue) { Remove-Item $png -Force }\r\n        $bitmap.Dispose()\r\n        $image.Dispose()\r\n        $graphics.Dispose()\r\n        [System.GC]::Collect()\r\n\r\n        # Refresh the icon cache depending on the OS version.\r\n        if ([System.Environment]::OSVersion.Version.Major -ge 10) {\r\n            Invoke-Command { ie4uinit.exe -show }\r\n        }\r\n        else {\r\n            Invoke-Command { ie4uinit.exe -ClearIconCache }\r\n        }\r\n    }\r\n\r\n    # Verify if the script is being run with elevated privileges.\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 (-not (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    # Retrieve all registry paths for actual users (excluding system or network service accounts).\r\n    function Get-UserHives {\r\n        param (\r\n            [Parameter()]\r\n            [ValidateSet('AzureAD', 'DomainAndLocal', 'All')]\r\n            [String]$Type = \"All\",\r\n            [Parameter()]\r\n            [String[]]$ExcludedUsers,\r\n            [Parameter()]\r\n            [switch]$IncludeDefault\r\n        )\r\n\r\n        # Different SID patterns for user account types: AzureAD, Domain, or Local.\r\n        $Patterns = switch ($Type) {\r\n            \"AzureAD\" { \"S-1-12-1-(\\d+-?){4}$\" }\r\n            \"DomainAndLocal\" { \"S-1-5-21-(\\d+-?){4}$\" }\r\n            \"All\" { \"S-1-12-1-(\\d+-?){4}$\" ; \"S-1-5-21-(\\d+-?){4}$\" } \r\n        }\r\n\r\n        # Extract user profiles that match the SID patterns. \r\n        $UserProfiles = Foreach ($Pattern in $Patterns) { \r\n            Get-ItemProperty \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\*\" |\r\n                Where-Object { $_.PSChildName -match $Pattern } | \r\n                Select-Object @{Name = \"SID\"; Expression = { $_.PSChildName } }, \r\n                @{Name = \"UserHive\"; Expression = { \"$($_.ProfileImagePath)\\NTuser.dat\" } }, \r\n                @{Name = \"UserName\"; Expression = { \"$($_.ProfileImagePath | Split-Path -Leaf)\" } },\r\n                @{Name = \"Path\"; Expression = { $_.ProfileImagePath } }\r\n        }\r\n\r\n        # Handle situations where information from the .Default user is required.\r\n        switch ($IncludeDefault) {\r\n            $True {\r\n                $DefaultProfile = \"\" | Select-Object UserName, SID, UserHive, Path\r\n                $DefaultProfile.UserName = \"Default\"\r\n                $DefaultProfile.SID = \"DefaultProfile\"\r\n                $DefaultProfile.Userhive = \"$env:SystemDrive\\Users\\Default\\NTUSER.DAT\"\r\n                $DefaultProfile.Path = \"C:\\Users\\Default\"\r\n\r\n                $DefaultProfile | Where-Object { $ExcludedUsers -notcontains $_.UserName }\r\n            }\r\n        }\r\n\r\n        $UserProfiles | Where-Object { $ExcludedUsers -notcontains $_.UserName }\r\n    }\r\n\r\n    # The actual shortcut creation\r\n    function New-Shortcut {\r\n        [CmdletBinding()]\r\n        param(\r\n            [Parameter()]\r\n            [String]$Arguments,\r\n            [Parameter()]\r\n            [String]$IconPath,\r\n            [Parameter(ValueFromPipeline = $True)]\r\n            [String]$Path,\r\n            [Parameter()]\r\n            [String]$Target,\r\n            [Parameter()]\r\n            [String]$WorkingDir\r\n        )\r\n        process {\r\n            Write-Host \"Creating Shortcut at $Path\"\r\n            $ShellObject = New-Object -ComObject (\"WScript.Shell\")\r\n            $Shortcut = $ShellObject.CreateShortcut($Path)\r\n            $Shortcut.TargetPath = $Target\r\n            if ($WorkingDir) { $Shortcut.WorkingDirectory = $WorkingDir }\r\n            if ($Arguments) { $ShortCut.Arguments = $Arguments }\r\n            if ($IconPath) { $Shortcut.IconLocation = $IconPath }\r\n            $Shortcut.Save()\r\n\r\n            if (-not (Test-Path $Path -ErrorAction SilentlyContinue)) {\r\n                Write-Host \"[Error] Unable to create Shortcut at $Path\"\r\n                exit 1\r\n            }\r\n        }\r\n    }\r\n}\r\nprocess {\r\n    $ShortcutPath = New-Object System.Collections.Generic.List[String]\r\n\r\n    # Creating the filename's for the path\r\n    if ($Url) { $File = \"$Name.url\"; $Target = $Url }\r\n    if ($ExePath) { $File = \"$Name.lnk\"; $Target = $ExePath }\r\n    if ($RDPTarget) { $File = \"$Name.rdp\" }\r\n\r\n    # Grabing the excluded users\r\n    if ($ExcludeUsers) { $ExcludedUsers = ($ExcludeUsers -split \",\").trim() }\r\n\r\n    # Building the path's and adding it to the ShortcutPath list\r\n    if ($AllUsers) { $ShortcutPath.Add(\"$env:Public\\Desktop\\$File\") }\r\n\r\n    if ($AllExistingUsers) {\r\n        $UserProfiles = Get-UserHives -ExcludedUsers $ExcludedUsers\r\n        # Loop through each user profile\r\n        $UserProfiles | ForEach-Object { $ShortcutPath.Add(\"$($_.Path)\\Desktop\\$File\") }\r\n    }\r\n\r\n    if ($User) { \r\n        $UserProfile = Get-UserHives | Where-Object { $_.Username -like $User }\r\n        $ShortcutPath.Add(\"$($UserProfile.Path)\\Desktop\\$File\")\r\n    }\r\n\r\n    $ShortcutArguments = @{\r\n        Target     = $Target\r\n        WorkingDir = $StartIn\r\n        Arguments  = $Arguments\r\n    }\r\n\r\n    # If we're given a url we'll want to download it\r\n    if ($IconUrl) {\r\n        $DownloadArguments = @{\r\n            URL      = $IconUrl\r\n            BaseName = \"$IconDirectory\\$Name\"\r\n        }\r\n        if ($SkipSleep) { $DownloadArguments[\"SkipSleep\"] = $True }\r\n\r\n        $Icon = Invoke-Download @DownloadArguments\r\n        if ($Icon -and -not (Test-Path $Icon -ErrorAction SilentlyContinue)) {\r\n            $ExitCode = 1\r\n            $Icon = $Null\r\n            $IconUrl = $Null\r\n        }\r\n    }\r\n\r\n    # This will convert the base64 into an image and save it to the temp folder\r\n    if ($IconBase64 -and $IconDirectory -and -not $Icon -and -not $IconUrl) {\r\n        Write-Verbose \"Converting Icon base64 to original image and saving to $IconDirectory...\"\r\n        ConvertFrom-Base64 -Base64 $IconBase64 -Path \"$IconDirectory\\$Name.Png\"\r\n        $Icon = \"$IconDirectory\\$Name.Png\"\r\n    }\r\n\r\n    if ($Icon -and (Get-Item -Path $Icon).Extension -notlike \".ico\") {\r\n        $FileHash = \"$((Get-FileHash -Path $Icon -Algorithm MD5).Hash)\"\r\n        Write-Verbose \"Converting image to icon and saving to $IconDirectory\\$FileHash.ico ...\"\r\n        ConvertFrom-Image -ImagePath $Icon -Path \"$IconDirectory\\$FileHash.ico\"\r\n        Remove-Item -Path $Icon -Force\r\n        $Icon = \"$IconDirectory\\$FileHash.ico\"\r\n    }\r\n    elseif ($Icon -and (Test-Path $Icon -ErrorAction SilentlyContinue)) {\r\n        $FileHash = \"$((Get-FileHash -Path $Icon -Algorithm MD5).Hash)\"\r\n        Move-Item -Path $Icon -Destination \"$IconDirectory\\$FileHash.ico\"\r\n        $Icon = \"$IconDirectory\\$FileHash.ico\"\r\n    }\r\n\r\n    if ($Icon -and (Test-Path $Icon -ErrorAction SilentlyContinue)) {\r\n        $ShortcutArguments[\"IconPath\"] = $Icon\r\n    }\r\n    elseif ($Icon) {\r\n        $ExitCode = 1\r\n    }\r\n\r\n    $ShortcutPath | New-Shortcut @ShortcutArguments\r\n\r\n    exit $ExitCode\r\n}end {\r\n    \r\n    \r\n    \r\n}<\/pre>\n<p>&nbsp;<\/p>\n\n<div class=\"blog-cta-new blog-cta-style-1\"><div class=\"cta-left\"><h2><\/h2><p><\/p><\/div><div class=\"cta-right\"><a class=\"button\" href=\"\"><\/a><\/div><\/div>\n<h2>Description d\u00e9taill\u00e9e<\/h2>\n<h3>Synopsis et param\u00e8tres du script<\/h3>\n<p>La fonction principale du script PowerShell est de cr\u00e9er des raccourcis sur le bureau pour des ex\u00e9cutables avec des options sp\u00e9cifiques. Il permet de cr\u00e9er des raccourcis pour tous les utilisateurs, y compris les nouveaux, ou uniquement pour les utilisateurs existants. Voici un aper\u00e7u de ses param\u00e8tres et de ses fonctionnalit\u00e9s :<\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"1\" data-aria-level=\"1\"><strong>Nom<\/strong>: Le nom du raccourci, par exemple \u00ab\u00a0Login Portal\u00a0\u00bb.<\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"2\" data-aria-level=\"1\"><strong>ExePath<\/strong>: Chemin d&rsquo;acc\u00e8s au fichier ex\u00e9cutable.<\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"3\" data-aria-level=\"1\"><strong>Arguments<\/strong>: Tout argument \u00e0 transmettre \u00e0 l&rsquo;ex\u00e9cutable.<\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"4\" data-aria-level=\"1\"><strong>StartIn<\/strong>: Le r\u00e9pertoire dans lequel l&rsquo;ex\u00e9cutable doit d\u00e9marrer.<\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"5\" data-aria-level=\"1\"><strong>Ic\u00f4ne<\/strong>: Chemin d&rsquo;acc\u00e8s \u00e0 un fichier image pour l&rsquo;ic\u00f4ne du raccourci.<\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"6\" data-aria-level=\"1\"><strong>IconDirectory<\/strong>: R\u00e9pertoire dans lequel est stock\u00e9 le fichier d&rsquo;ic\u00f4nes.<\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"7\" data-aria-level=\"1\"><strong>IconURL<\/strong>: URL d&rsquo;un fichier image pour l&rsquo;ic\u00f4ne du raccourci.<\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"8\" data-aria-level=\"1\"><strong>Tous les utilisateurs existants<\/strong>: Cr\u00e9e le raccourci pour tous les utilisateurs existants.<\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"9\" data-aria-level=\"1\"><strong>Tous les utilisateurs<\/strong>: Cr\u00e9e le raccourci pour tous les utilisateurs, y compris les nouveaux.<\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"10\" data-aria-level=\"1\"><strong>Exclure les utilisateurs<\/strong>: Liste des utilisateurs \u00e0 exclure de la cr\u00e9ation de raccourcis.<\/li>\n<\/ul>\n<h2>Fonctionnalit\u00e9 du script<\/h2>\n<h3><em>Configuration initiale<\/em><\/h3>\n<p>Le script commence par ajouter l&rsquo;assemblage .NET n\u00e9cessaire pour le dessin, qui est crucial pour la gestion des fichiers image. Il comprend \u00e9galement une section permettant de g\u00e9rer les ic\u00f4nes encod\u00e9es en base64, ce qui offre une certaine souplesse pour la cr\u00e9ation d&rsquo;ic\u00f4nes dynamiques.<\/p>\n<h3><em>Traitement des param\u00e8tres<\/em><\/h3>\n<p>Les variables d&rsquo;environnement peuvent remplacer les param\u00e8tres fournis, ce qui permet au script de s&rsquo;adapter \u00e0 diff\u00e9rentes conditions d&rsquo;ex\u00e9cution. Ceci est particuli\u00e8rement utile dans les sc\u00e9narios de d\u00e9ploiement automatis\u00e9.<\/p>\n<h3><em>Validation par l&rsquo;utilisateur<\/em><\/h3>\n<p>Avant de poursuivre, le script v\u00e9rifie qu&rsquo;un utilisateur est sp\u00e9cifi\u00e9 pour la cr\u00e9ation de raccourcis. Cela permet d&rsquo;\u00e9viter les erreurs et de s&rsquo;assurer que le script cible les bons profils d&rsquo;utilisateurs.<\/p>\n<h3><em>Traitement des ic\u00f4nes<\/em><\/h3>\n<p>Le script comprend une gestion robuste des ic\u00f4nes :<\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"11\" data-aria-level=\"1\">Il v\u00e9rifie que les formats de fichiers sont valides.<\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"12\" data-aria-level=\"1\">T\u00e9l\u00e9charge des ic\u00f4nes \u00e0 partir d&rsquo;URL si elles sont fournies.<\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"13\" data-aria-level=\"1\">Convertit les images encod\u00e9es en base64 en fichiers d&rsquo;ic\u00f4nes.<\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"14\" data-aria-level=\"1\">Convertit divers formats d&rsquo;images en fichiers .ico si n\u00e9cessaire.<\/li>\n<\/ul>\n<h3><em>Cr\u00e9ation de raccourcis<\/em><\/h3>\n<p>En utilisant l&rsquo;objet COM WScript.Shell, le script cr\u00e9e des raccourcis avec les param\u00e8tres sp\u00e9cifi\u00e9s. Il prend en charge plusieurs profils d&rsquo;utilisateurs, y compris tous les utilisateurs existants ou tous les utilisateurs, en parcourant les r\u00e9pertoires d&rsquo;utilisateurs.<\/p>\n<h2>Cas d&rsquo;utilisation potentiels<\/h2>\n<h3><em>Sc\u00e9nario du monde r\u00e9el<\/em><\/h3>\n<p>Prenons l&rsquo;exemple d&rsquo;un service informatique d&rsquo;une grande entreprise qui doit d\u00e9ployer un nouveau syst\u00e8me ERP. L&rsquo;\u00e9quipe informatique peut utiliser ce script pour cr\u00e9er un raccourci pour l&rsquo;application ERP sur le bureau de tous les utilisateurs. En sp\u00e9cifiant le chemin d&rsquo;acc\u00e8s \u00e0 l&rsquo;ex\u00e9cutable, le r\u00e9pertoire de d\u00e9marrage et l&rsquo;ic\u00f4ne personnalis\u00e9e, l&rsquo;\u00e9quipe garantit une exp\u00e9rience utilisateur coh\u00e9rente et professionnelle. La capacit\u00e9 du script \u00e0 g\u00e9rer plusieurs profils d&rsquo;utilisateurs simplifie le d\u00e9ploiement dans l&rsquo;ensemble de l&rsquo;entreprise.<\/p>\n<h2>Comparaisons<\/h2>\n<p>La cr\u00e9ation de raccourcis de bureau manuellement ou par le biais de strat\u00e9gies de groupe peut s&rsquo;av\u00e9rer fastidieuse et moins flexible que l&rsquo;utilisation d&rsquo;un script PowerShell. Les strat\u00e9gies de groupe permettent une certaine automatisation, mais n&rsquo;offrent pas le contr\u00f4le granulaire et la personnalisation qu&rsquo;offre ce script. En outre, le script peut g\u00e9rer des sc\u00e9narios dynamiques tels que le t\u00e9l\u00e9chargement d&rsquo;ic\u00f4nes \u00e0 partir d&rsquo;URL ou la conversion d&rsquo;images encod\u00e9es en base64, ce qui n&rsquo;est pas possible avec les m\u00e9thodes traditionnelles.<\/p>\n<h2>FAQ<\/h2>\n<ol>\n<li><strong> Ce script peut-il fonctionner sur toutes les versions de Windows ?<\/strong> Le script prend en charge Windows 7 et les versions plus r\u00e9centes, y compris Windows Server 2008 et sup\u00e9rieur.<\/li>\n<li><strong> Que se passe-t-il si le fichier d&rsquo;ic\u00f4nes n&rsquo;est pas valide ?<\/strong> Le script cr\u00e9era par d\u00e9faut le raccourci sans ic\u00f4ne si le fichier d&rsquo;ic\u00f4ne sp\u00e9cifi\u00e9 n&rsquo;est pas valide.<\/li>\n<li><strong> Comment le script g\u00e8re-t-il les autorisations ?<\/strong> Le script v\u00e9rifie la pr\u00e9sence de privil\u00e8ges \u00e9lev\u00e9s afin de s&rsquo;assurer qu&rsquo;il dispose des autorisations n\u00e9cessaires pour cr\u00e9er des raccourcis dans plusieurs profils d&rsquo;utilisateurs.<\/li>\n<li><strong> Le script peut-il \u00eatre modifi\u00e9 pour prendre en charge des param\u00e8tres suppl\u00e9mentaires ?<\/strong> Oui, le script est con\u00e7u pour \u00eatre modulaire et peut \u00eatre facilement \u00e9tendu pour prendre en charge des param\u00e8tres ou des fonctionnalit\u00e9s suppl\u00e9mentaires.<\/li>\n<\/ol>\n<h2>Implications<\/h2>\n<p>L&rsquo;automatisation de la cr\u00e9ation de raccourcis de bureau \u00e0 l&rsquo;aide de ce script PowerShell peut consid\u00e9rablement rationaliser les op\u00e9rations informatiques, en r\u00e9duisant les efforts manuels et en <a href=\"https:\/\/www.ninjaone.com\/blog\/how-human-error-relates-to-cybersecurity-risks\/\" target=\"_blank\" rel=\"noopener\">minimisant les risques d&rsquo;erreurs<\/a>. Cependant, il est essentiel de s&rsquo;assurer que le script s&rsquo;ex\u00e9cute avec les autorisations appropri\u00e9es afin d&rsquo;\u00e9viter les probl\u00e8mes de s\u00e9curit\u00e9. Une bonne gestion et distribution des raccourcis permet \u00e9galement de maintenir un environnement de bureau propre et organis\u00e9 pour les utilisateurs.<\/p>\n<h2>Recommandations<\/h2>\n<p>Lors de l&rsquo;utilisation de ce script :<\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"15\" data-aria-level=\"1\">Testez toujours dans un environnement contr\u00f4l\u00e9 avant de le d\u00e9ployer aupr\u00e8s de tous les utilisateurs.<\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"16\" data-aria-level=\"1\">Veillez \u00e0 ce que le r\u00e9pertoire d&rsquo;ic\u00f4nes soit accessible \u00e0 tous les utilisateurs cibl\u00e9s.<\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"17\" data-aria-level=\"1\">Mettez r\u00e9guli\u00e8rement \u00e0 jour le script pour g\u00e9rer les nouveaux profils d&rsquo;utilisateurs et l&rsquo;\u00e9volution des besoins.<\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"18\" data-aria-level=\"1\">Conservez une documentation claire sur toutes les modifications apport\u00e9es au script.<\/li>\n<\/ul>\n<h2>Conclusion<\/h2>\n<p>Les scripts PowerShell comme celui-ci sont des outils puissants pour les professionnels de l&rsquo;informatique, car ils permettent d&rsquo;automatiser et de personnaliser les t\u00e2ches de routine. Pour les services informatiques et les MSP, l&rsquo;utilisation de ces scripts peut conduire \u00e0 des op\u00e9rations plus efficaces et \u00e0 une meilleure exp\u00e9rience pour l&rsquo;utilisateur final.<\/p>\n<p>NinjaOne, une plateforme compl\u00e8te de gestion informatique, peut int\u00e9grer de tels scripts dans ses flux d&rsquo;automatisation, fournissant ainsi une solution transparente et puissante pour la gestion des environnements informatiques \u00e0 grande \u00e9chelle. En comprenant et en utilisant ce script PowerShell, les professionnels de l&rsquo;informatique peuvent am\u00e9liorer leur bo\u00eete \u00e0 outils et assurer une gestion <a href=\"https:\/\/www.ninjaone.com\/fr\/efficacite\" target=\"_blank\" rel=\"noopener\">efficace<\/a> des environnements de bureau.<\/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":"","_lmt_disable":""},"operating_system":[4212],"use_cases":[4281],"class_list":["post-353667","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\/353667","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=353667"}],"wp:attachment":[{"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/media?parent=353667"}],"wp:term":[{"taxonomy":"script_hub_category","embeddable":true,"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/operating_system?post=353667"},{"taxonomy":"use_cases","embeddable":true,"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/use_cases?post=353667"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}