{"id":353738,"date":"2024-08-26T08:11:38","date_gmt":"2024-08-26T08:11:38","guid":{"rendered":"https:\/\/www.ninjaone.com\/script-hub\/creare-collegamenti-sul-desktop-con-powershell\/"},"modified":"2024-10-13T19:09:52","modified_gmt":"2024-10-13T19:09:52","slug":"creare-collegamenti-sul-desktop-con-powershell","status":"publish","type":"script_hub","link":"https:\/\/www.ninjaone.com\/it\/script-hub\/creare-collegamenti-sul-desktop-con-powershell\/","title":{"rendered":"Come creare collegamenti sul desktop con PowerShell: Una guida passo per passo"},"content":{"rendered":"<p><strong>Creare collegamenti sul desktop<\/strong> in modo programmatico pu\u00f2 far risparmiare ai professionisti IT una quantit\u00e0 significativa di tempo e lavoro, soprattutto quando gestiscono ambienti con pi\u00f9 utenti. <a href=\"https:\/\/www.ninjaone.com\/it\/it-hub\/gestione-degli-endpoint\/cos-e-powershell\/\" target=\"_blank\" rel=\"noopener\">PowerShell<\/a>, un potente linguaggio di scripting nativo di Windows, offre la flessibilit\u00e0 e le funzionalit\u00e0 necessarie per automatizzare questo compito in modo efficiente.<\/p>\n<p>In questo articolo analizzeremo uno script PowerShell completo progettato per creare collegamenti sul desktop per gli eseguibili, illustrandone l&#8217;uso, le funzionalit\u00e0 e i vantaggi per i professionisti IT e i <a href=\"https:\/\/www.ninjaone.com\/it\/cos-e-un-msp\/\" target=\"_blank\" rel=\"noopener\">fornitori di servizi gestiti (MSP)<\/a>.<\/p>\n<h2>Background<\/h2>\n<p>Negli ambienti IT di grandi dimensioni, gestire i desktop degli utenti e garantire l&#8217;uniformit\u00e0 tra tutti i sistemi pu\u00f2 essere una sfida. I collegamenti sul desktop sono una parte semplice ma essenziale di questa gestione, in quanto forniscono un accesso rapido ad applicazioni, siti web e file.<\/p>\n<p>La creazione manuale di questi collegamenti per ogni utente non \u00e8 fattibile, soprattutto nelle aziende con numerosi utenti. \u00c8 qui che l&#8217;automazione con gli script di PowerShell diventa preziosa. Lo script in questione non solo crea collegamenti, ma permette anche di personalizzarli con parametri come i percorsi delle icone, gli argomenti dell&#8217;eseguibile e le impostazioni specifiche dell&#8217;utente.<\/p>\n<h2>Lo script per creare collegamenti sul desktop<\/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>Analisi dettagliata<\/h2>\n<h3>Sinossi e parametri dello script<\/h3>\n<p>La funzione principale dello script PowerShell \u00e8 quella di creare collegamenti sul desktop per gli eseguibili con le opzioni specificate. Supporta la creazione di collegamenti per tutti gli utenti, compresi quelli nuovi, o solo per gli utenti esistenti. Ecco una panoramica dei suoi parametri e delle sue funzionalit\u00e0:<\/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>Name<\/strong>: Il nome del collegamento, ad esempio &#8220;Portale di accesso&#8221;.<\/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>: Il percorso del file eseguibile.<\/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>Argomenti<\/strong>: Qualsiasi argomento da passare all&#8217;eseguibile.<\/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>: La directory in cui avviare l&#8217;eseguibile.<\/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>Icon<\/strong>: Percorso di un file immagine per l&#8217;icona del collegamento.<\/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>: Directory in cui memorizzare il file dell&#8217;icona.<\/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 di un file immagine per l&#8217;icona di collegamento.<\/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>AllExistingUsers<\/strong>: Crea il collegamento per tutti gli utenti esistenti.<\/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>AllUsers<\/strong>: Crea il collegamento per tutti gli utenti, compresi quelli che verranno creati successivamente.<\/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>ExcludeUsers<\/strong>: Elenco di utenti da escludere dalla creazione di collegamenti.<\/li>\n<\/ul>\n<h2>Funzionalit\u00e0 dello script<\/h2>\n<h3><em>Impostazione iniziale<\/em><\/h3>\n<p>Lo script per creare collegamenti sul desktop inizia aggiungendo l&#8217;assembly .NET necessario per il disegno, fondamentale per la gestione dei file immagine. Include anche una sezione per la gestione delle icone codificate in base64, fornendo flessibilit\u00e0 per la creazione di icone dinamiche.<\/p>\n<h3><em>Gestione dei parametri<\/em><\/h3>\n<p>Le variabili d&#8217;ambiente possono sovrascrivere i parametri forniti, assicurando che lo script per creare collegamenti sul desktop possa adattarsi alle diverse condizioni di esecuzione. Questo \u00e8 particolarmente utile negli scenari di distribuzione automatizzata.<\/p>\n<h3><em>Convalida dell&#8217;utente<\/em><\/h3>\n<p>Prima di procedere, lo script per creare collegamenti sul desktop verifica che sia stato specificato un utente per la creazione del collegamento. In questo modo si evitano errori e si garantisce che lo script per creare collegamenti sul desktop si rivolga ai profili utente corretti.<\/p>\n<h3><em>Gestione delle icone<\/em><\/h3>\n<p>Lo script per creare collegamenti sul desktop include un sistema affidabile di gestione delle icone:<\/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\">Controlla i formati di file validi.<\/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\">Scarica le icone dagli URL, se forniti.<\/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\">Converte le immagini codificate in base64 in file di icone.<\/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\">Converte vari formati di immagine in file .ico, se necessario.<\/li>\n<\/ul>\n<h3><em>Creazione dei collegamenti<\/em><\/h3>\n<p>Utilizzando l&#8217;oggetto WScript.Shell COM, lo script crea dei collegamenti con i parametri specificati. Supporta pi\u00f9 profili utente, come \u201ctutti gli utenti esistenti\u201d o \u201ctutti gli utenti esistenti e che verranno creati\u201d, iterando attraverso le directory degli utenti.<\/p>\n<h2>Casi d&#8217;uso potenziali<\/h2>\n<h3><em>Scenario concreto<\/em><\/h3>\n<p>Immagina il reparto IT di una grande organizzazione che deve implementare un nuovo sistema ERP. Il team IT pu\u00f2 utilizzare questo script per creare un collegamento sul desktop per l&#8217;applicazione ERP su tutti i desktop degli utenti. Specificando il percorso dell&#8217;eseguibile, la directory di avvio e l&#8217;icona personalizzata, il team garantir\u00e0 un&#8217;esperienza utente coerente e professionale. La capacit\u00e0 dello script per creare collegamenti sul desktop di gestire pi\u00f9 profili utente semplifica l&#8217;implementazione in tutta l&#8217;organizzazione.<\/p>\n<h2>Confronti<\/h2>\n<p>Creare collegamenti sul desktop manualmente o tramite i criteri di gruppo pu\u00f2 essere macchinoso e meno flessibile rispetto all&#8217;uso di uno script PowerShell. I criteri di gruppo forniscono una certa automazione, ma mancano del controllo granulare e della personalizzazione offerti da questo script per creare collegamenti sul desktop. Inoltre, lo script \u00e8 in grado di gestire scenari dinamici come il download di icone da URL o la conversione di immagini codificate in base64, che non sono fattibili con i metodi tradizionali.<\/p>\n<h2>Domande frequenti<\/h2>\n<ol>\n<li><strong> Questo script per creare collegamenti sul desktop pu\u00f2 essere eseguito su tutte le versioni di Windows?<\/strong> Lo script per creare collegamenti sul desktop supporta Windows 7 e le versioni successive, compreso Windows Server 2008 e versioni successive.<\/li>\n<li><strong> Cosa succede se il file dell&#8217;icona non \u00e8 valido?<\/strong> Se il file di icone specificato non \u00e8 valido, lo script crea il collegamento senza icona.<\/li>\n<li><strong> Come vengono gestite le autorizzazioni dallo script per creare collegamenti sul desktop?<\/strong> Lo script per creare collegamenti sul desktop verifica la presenza di privilegi elevati per assicurarsi di avere le autorizzazioni necessarie per creare collegamenti su pi\u00f9 profili utente.<\/li>\n<li><strong> \u00c8 possibile modificare lo\u00a0script per creare collegamenti sul desktop per supportare altri parametri?<\/strong> S\u00ec, lo script per creare collegamenti sul desktop \u00e8 stato progettato per essere modulare e pu\u00f2 essere facilmente esteso per supportare ulteriori parametri o funzionalit\u00e0.<\/li>\n<\/ol>\n<h2>Implicazioni<\/h2>\n<p>L&#8217;automazione della creazione di collegamenti sul desktop con questo script PowerShell pu\u00f2 snellire in modo significativo le operazioni IT, riducendo il lavoro manuale e <a href=\"https:\/\/www.ninjaone.com\/it\/blog\/come-l-errore-umano-influisce-sui-rischi-di-cybersecurity\/\" target=\"_blank\" rel=\"noopener\">minimizzando il potenziale di errore<\/a>. Tuttavia, \u00e8 essenziale assicurarsi che lo script per creare collegamenti sul desktop venga eseguito con i permessi appropriati per evitare problemi di sicurezza. La corretta gestione e distribuzione dei collegamenti aiuta anche a mantenere un ambiente desktop pulito e organizzato per gli utenti.<\/p>\n<h2>Raccomandazioni<\/h2>\n<p>Durante l\u2019utilizzo di questo script per creare collegamenti sul desktop:<\/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\">Testalo sempre in un ambiente controllato prima di distribuire a tutti gli utenti.<\/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\">Assicurati che la directory delle icone sia accessibile a tutti gli utenti interessati.<\/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\">Aggiorna regolarmente lo script per creare collegamenti sul desktop, in modo da gestire i nuovi profili utente e di adattarlo ai requisiti in evoluzione.<\/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\">Mantieni una documentazione chiara per qualsiasi modifica apportata allo script per creare collegamenti sul desktop.<\/li>\n<\/ul>\n<h2>Considerazioni finali<\/h2>\n<p>Gli script PowerShell come questo per creare collegamenti sul desktop sono strumenti potenti per i professionisti IT, in quanto offrono automazione e personalizzazione che semplificano le attivit\u00e0 di routine. Per i reparti IT e gli MSP, l&#8217;utilizzo di script come questo pu\u00f2 portare a operazioni pi\u00f9 efficienti e a una migliore esperienza dell&#8217;utente finale.<\/p>\n<p>NinjaOne, una piattaforma di gestione IT completa, \u00e8 in grado di integrare script come questo nei suoi flussi di lavoro di automazione, fornendo una soluzione potente e fluida per la gestione degli ambienti IT anche su larga scala. Grazie alla comprensione e all&#8217;utilizzo di questo script PowerShell, i professionisti IT possono migliorare il loro kit di strumenti, garantendo una gestione <a href=\"https:\/\/www.ninjaone.com\/it\/efficienza-it\/\" target=\"_blank\" rel=\"noopener\">efficiente<\/a> ed efficace degli ambienti desktop.<\/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":[4269],"class_list":["post-353738","script_hub","type-script_hub","status-publish","hentry","script_hub_category-windows"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.ninjaone.com\/it\/wp-json\/wp\/v2\/script_hub\/353738","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ninjaone.com\/it\/wp-json\/wp\/v2\/script_hub"}],"about":[{"href":"https:\/\/www.ninjaone.com\/it\/wp-json\/wp\/v2\/types\/script_hub"}],"author":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/it\/wp-json\/wp\/v2\/users\/35"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/it\/wp-json\/wp\/v2\/comments?post=353738"}],"wp:attachment":[{"href":"https:\/\/www.ninjaone.com\/it\/wp-json\/wp\/v2\/media?parent=353738"}],"wp:term":[{"taxonomy":"script_hub_category","embeddable":true,"href":"https:\/\/www.ninjaone.com\/it\/wp-json\/wp\/v2\/operating_system?post=353738"},{"taxonomy":"use_cases","embeddable":true,"href":"https:\/\/www.ninjaone.com\/it\/wp-json\/wp\/v2\/use_cases?post=353738"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}