{"id":208120,"date":"2023-09-27T07:58:37","date_gmt":"2023-09-27T07:58:37","guid":{"rendered":"https:\/\/www.ninjaone.com\/script-hub\/aggiornamento-automatico-a-windows-11-powershell-2\/"},"modified":"2024-03-04T19:13:05","modified_gmt":"2024-03-04T19:13:05","slug":"aggiornamento-automatico-a-windows-11-powershell-2","status":"publish","type":"script_hub","link":"https:\/\/www.ninjaone.com\/it\/script-hub\/aggiornamento-automatico-a-windows-11-powershell-2\/","title":{"rendered":"Come attivare l&#8217;aggiornamento automatico a Windows 11 con uno script PowerShell personalizzato"},"content":{"rendered":"<p><span class=\"TextRun SCXW212525688 BCX0\" lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW212525688 BCX0\">Con l&#8217;avvento di Windows 11, abilitare l&#8217;aggiornamento \u00e8 diventata un obiettivo primario per i professionisti IT. La comprensione e la gestione delle transizioni dei sistemi operativi \u00e8 fondamentale nel settore IT, soprattutto perch\u00e9 le aziende si impegnano a rimanere compatibili con le tecnologie pi\u00f9 recenti. Lo script in questione offre un modo semplificato per preparare la strada all&#8217;aggiornamento automatico a Windows 11.<\/span><\/span><\/p>\n<h2>Background<\/h2>\n<p><span class=\"NormalTextRun SCXW9337786 BCX0\">Lo scopo dello script \u00e8 semplice: abilitare l&#8217;aggiornamento automatico a Windows 11. Specificamente adattato all&#8217;architettura del sistema operativo Windows 10, il suo scopo principale \u00e8 quello di attivare l&#8217;offerta di aggiornamento a Windows 11 per gli utenti. Per i professionisti IT e i Managed Service Provider (MSP) \u00e8 fondamentale garantire che gli utenti finali ricevano <\/span><span class=\"NormalTextRun SCXW9337786 BCX0\">tempestivamente<\/span><span class=\"NormalTextRun SCXW9337786 BCX0\"> gli aggiornamenti senza intoppi. <\/span><span class=\"NormalTextRun SCXW9337786 BCX0\">Mantenendo la <\/span><span class=\"NormalTextRun SCXW9337786 BCX0\"> compatibilit\u00e0 del sistema e<\/span><span class=\"NormalTextRun SCXW9337786 BCX0\"> sfruttando le <\/span><span class=\"NormalTextRun SCXW9337786 BCX0\">funzionalit\u00e0 pi\u00f9 recenti, le aziende possono garantire<\/span><span class=\"NormalTextRun SCXW9337786 BCX0\"> prestazioni e sicurezza <\/span><span class=\"NormalTextRun SCXW9337786 BCX0\">ottimali<\/span>.<\/p>\n<h2>Lo script per abilitare l\u2019aggiornamento automatico a Windows 11<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\">&lt;#\r\n.SYNOPSIS\r\n    Enables Windows 11 upgrade.\r\n.DESCRIPTION\r\n    Enables Windows 11 upgrade.\r\n.EXAMPLE\r\n    No parameters needed\r\n    Enables Windows 11 upgrade.\r\n.OUTPUTS\r\n    None\r\n.NOTES\r\n    Minimum OS Architecture Supported: Windows 10\r\n    Release Notes:\r\n    Allows the upgrade offer to Windows 11 to appear to users\r\n    (c) 2023 NinjaOne\r\n    By using this script, you indicate your acceptance of the following legal terms as well as our Terms of Use at https:\/\/www.ninjaone.com\/terms-of-use.\r\n    Ownership Rights: NinjaOne owns and will continue to own all right, title, and interest in and to the script (including the copyright). NinjaOne is giving you a limited license to use the script in accordance with these legal terms. \r\n    Use Limitation: You may only use the script for your legitimate personal or internal business purposes, and you may not share the script with another party. \r\n    Republication Prohibition: Under no circumstances are you permitted to re-publish the script in any script library or website belonging to or under the control of any other software provider. \r\n    Warranty Disclaimer: The script is provided \u201cas is\u201d and \u201cas available\u201d, without warranty of any kind. NinjaOne makes no promise or guarantee that the script will be free from defects or that it will meet your specific needs or expectations. \r\n    Assumption of Risk: Your use of the script is at your own risk. You acknowledge that there are certain inherent risks in using the script, and you understand and assume each of those risks. \r\n    Waiver and Release: You will not hold NinjaOne responsible for any adverse or unintended consequences resulting from your use of the script, and you waive any legal or equitable rights or remedies you may have against NinjaOne relating to your use of the script. \r\n    EULA: If you are a NinjaOne customer, your use of the script is subject to the End User License Agreement applicable to you (EULA).\r\n#&gt;\r\n[CmdletBinding()]\r\nparam ()\r\n\r\nbegin {\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\nprocess {\r\n    if (-not (Test-IsElevated)) {\r\n        Write-Error -Message \"Access Denied. Please run with Administrator privileges.\"\r\n        exit 1\r\n    }\r\n\r\n    $Splat = @{\r\n        Path        = \"HKLM:SOFTWAREPoliciesMicrosoftWindowsWindowsUpdate\"\r\n        Name        = @(\"TargetReleaseVersion\", \"TargetReleaseVersionInfo\")\r\n        ErrorAction = \"SilentlyContinue\"\r\n    }\r\n\r\n    Remove-ItemProperty @Splat -Force\r\n    Remove-ItemProperty -Path \"HKLM:SOFTWAREMicrosoftWindowsUpdateUXSettings\" -Name \"SvOfferDeclined\" -Force -ErrorAction SilentlyContinue\r\n    $TargetResult = Get-ItemProperty @Splat\r\n    $OfferResult = Get-ItemProperty -Path \"HKLM:SOFTWAREMicrosoftWindowsUpdateUXSettings\" -Name \"SvOfferDeclined\" -ErrorAction SilentlyContinue\r\n    if ($null -ne $TargetResult -or $null -ne $OfferResult) {\r\n        Write-Host \"Failed to enable Windows 11 Upgrade.\"\r\n        exit 1\r\n    }\r\n    exit 0\r\n}\r\nend {}<\/pre>\n<p>&nbsp;<\/p>\n\n<div class=\"in-context-cta\"><p>Accedi a oltre 300 script nel Dojo di NinjaOne<\/p>\n<p><a href=\"https:\/\/www.ninjaone.com\/it\/prova-gratuita\/\">Ottieni l&#8217;accesso<\/a><\/p>\n<\/div>\n<h2>Analisi dettagliata dello script<\/h2>\n<h3>Fase di preparazione<\/h3>\n<p><span data-contrast=\"auto\">Lo script per l\u2019aggiornamento automatico a Windows 11 inizia con un attributo CmdletBinding, comunemente utilizzato per le funzioni avanzate in PowerShell. Non richiede alcun parametro.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Lo script che abilita l\u2019aggiornamento automatico a Windows 11 controlla quindi se l&#8217;utente che lo esegue dispone di diritti amministrativi con la funzione Test-IsElevated.<\/span><\/p>\n<h3>Fase di esecuzione<\/h3>\n<p><span data-contrast=\"auto\">Se l&#8217;utente non ha diritti amministrativi, viene lanciato un messaggio di errore.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Lo script per l\u2019aggiornamento automatico a Windows 11 definisce una variabile $Splat che contiene informazioni relative al percorso del registro di Windows Update e ad alcune propriet\u00e0.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Tenta quindi di rimuovere alcune propriet\u00e0 del registro di sistema relative all&#8217;aggiornamento di Windows utilizzando il comando Remove-ItemProperty, eliminando di fatto potenziali blocchi o versioni di destinazione specifiche che potrebbero impedire l&#8217;aggiornamento.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Infine, lo script per abilitare l&#8217;aggiornamento automatico a Windows 11 verifica se le propriet\u00e0 del registro sono state rimosse con successo. Se non \u00e8 successo, pu\u00f2 trattarsi di un errore nell&#8217;abilitazione dell&#8217;aggiornamento.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<h3>Fase di completamento<\/h3>\n<p><span class=\"TextRun SCXW92450057 BCX0\" lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW92450057 BCX0\">Lo script per abilitare l&#8217;aggiornamento automatico a Windows 11 termina con un codice di stato. Uno zero (0) <\/span><span class=\"NormalTextRun SCXW92450057 BCX0\">indica <\/span>un<span class=\"NormalTextRun SCXW92450057 BCX0\"> completamento positivo, mentre un (1) indica un errore.<\/span><\/span><\/p>\n<h2>Situazioni d&#8217;uso potenziali<\/h2>\n<p><span class=\"NormalTextRun SCXW119425255 BCX0\">Immagina un professionista IT, George, che lavora per un&#8217;azienda di medie dimensioni. L&#8217;azienda <\/span><span class=\"NormalTextRun ContextualSpellingAndGrammarErrorV2Themed SCXW119425255 BCX0\">decide<\/span><span class=\"NormalTextRun SCXW119425255 BCX0\"> di passare a Windows 11 per <\/span><span class=\"NormalTextRun SCXW119425255 BCX0\">sfruttare<\/span><span class=\"NormalTextRun SCXW119425255 BCX0\"> le sue nuove funzionalit\u00e0. George, incaricato di garantire una transizione senza problemi, <\/span><span class=\"NormalTextRun SCXW119425255 BCX0\">utilizza<\/span><span class=\"NormalTextRun SCXW119425255 BCX0\"> questo script per attivare l&#8217;aggiornamento automatico a Windows 11 in batch su tutti i sistemi, risparmiandosi un notevole lavoro manuale<\/span>.<\/p>\n<h2>Approccio alternativo<\/h2>\n<p><span class=\"NormalTextRun SCXW181511112 BCX0\">I metodi tradizionali per abilitare gli aggiornamenti di Windows 11 possono comportare modifiche manuali alle impostazioni di sistema o l&#8217;utilizzo di strumenti basati su GUI che richiedono molto tempo e sono soggetti a errori. Questo script automatizza il processo, rendendolo pi\u00f9 efficiente e <\/span><span class=\"NormalTextRun ContextualSpellingAndGrammarErrorV2Themed SCXW181511112 BCX0\">non soggetto a errori<\/span><span class=\"NormalTextRun SCXW181511112 BCX0\">.<\/span><\/p>\n<h2>Domande frequenti<\/h2>\n<ol>\n<li><b><span data-contrast=\"auto\">Questo script per l&#8217;aggiornamento automatico a Windows 11 funziona con sistemi operativi diversi da Windows 10?<\/span><\/b><br \/>\n<span data-contrast=\"auto\">Lo script per l&#8217;aggiornamento automatico a Windows 11 \u00e8 progettato principalmente per Windows 10, come evidenziato nelle note.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<li><b><span data-contrast=\"auto\">E se lo script non funziona?<\/span><\/b><br \/>\n<span data-contrast=\"auto\">\u00c8 essenziale eseguire lo script per l&#8217;aggiornamento automatico a Windows 11 con diritti amministrativi. In caso di problemi, \u00e8 consigliabile eseguire nuovamente l&#8217;operazione o consultare gli specialisti IT.<\/span><\/li>\n<\/ol>\n<h2>Implicazioni<\/h2>\n<p><span class=\"TextRun SCXW104018615 BCX0\" lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW104018615 BCX0\">Sebbene lo script offra un modo per attivare l&#8217;aggiornamento automatico a Windows 11 senza problemi, qualsiasi processo automatizzato comporta dei rischi. L&#8217;alterazione delle impostazioni del registro pu\u00f2 avere conseguenze indesiderate. I professionisti dell&#8217;IT devono assicurarsi di disporre di strategie di backup, testare lo script in ambienti controllati e dare sempre la priorit\u00e0 alla sicurezza informatica.<\/span><\/span><\/p>\n<h2>Suggerimenti<\/h2>\n<ul style=\"font-weight: 400;\">\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"2\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&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;}\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span data-contrast=\"auto\">Esegui sempre il backup dei dati critici e delle impostazioni di sistema prima di eseguire gli script.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"2\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&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;}\" aria-setsize=\"-1\" data-aria-posinset=\"2\" data-aria-level=\"1\"><span data-contrast=\"auto\">Testa lo script su un piccolo campione di macchine prima di una sua ampia distribuzione.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"2\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&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;}\" aria-setsize=\"-1\" data-aria-posinset=\"3\" data-aria-level=\"1\"><span data-contrast=\"auto\">Assicurati che gli utenti siano informati sugli aggiornamenti per evitare sorprese.<\/span><\/li>\n<\/ul>\n<h2>Considerazioni finali<\/h2>\n<p><span class=\"NormalTextRun SCXW158490362 BCX0\">La transizione a nuove versioni del sistema operativo pu\u00f2 essere scoraggiante. L&#8217;utilizzo di strumenti e script come quello descritto pu\u00f2 facilitare il processo. Inoltre, una <a href=\"https:\/\/www.ninjaone.com\/it\/\">piattaforma di gestione IT<\/a> come <\/span><span class=\"NormalTextRun SpellingErrorV2Themed SCXW158490362 BCX0\">NinjaOne<\/span><span class=\"NormalTextRun SCXW158490362 BCX0\"> pu\u00f2 <\/span><span class=\"NormalTextRun SCXW158490362 BCX0\">aiutare<\/span><span class=\"NormalTextRun SCXW158490362 BCX0\"> ulteriormente a gestire tali transizioni, offrendo funzionalit\u00e0 di monitoraggio e automazione che sono preziose nell&#8217;attuale panorama IT in rapida evoluzione<\/span>.<\/p>\n","protected":false},"author":35,"featured_media":207176,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"_acf_changed":false,"_relevanssi_hide_post":"","_relevanssi_hide_content":"","_relevanssi_pin_for_all":"","_relevanssi_pin_keywords":"","_relevanssi_unpin_keywords":"","_relevanssi_related_keywords":"","_relevanssi_related_include_ids":"","_relevanssi_related_exclude_ids":"","_relevanssi_related_no_append":"","_relevanssi_related_not_related":"","_relevanssi_related_posts":"","_relevanssi_noindex_reason":"","_lmt_disableupdate":"no","_lmt_disable":""},"operating_system":[4212],"use_cases":[4275],"class_list":["post-208120","script_hub","type-script_hub","status-publish","has-post-thumbnail","hentry","script_hub_category-windows","use_cases-configurazione-del-sistema"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.ninjaone.com\/it\/wp-json\/wp\/v2\/script_hub\/208120","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=208120"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/it\/wp-json\/wp\/v2\/media\/207176"}],"wp:attachment":[{"href":"https:\/\/www.ninjaone.com\/it\/wp-json\/wp\/v2\/media?parent=208120"}],"wp:term":[{"taxonomy":"script_hub_category","embeddable":true,"href":"https:\/\/www.ninjaone.com\/it\/wp-json\/wp\/v2\/operating_system?post=208120"},{"taxonomy":"use_cases","embeddable":true,"href":"https:\/\/www.ninjaone.com\/it\/wp-json\/wp\/v2\/use_cases?post=208120"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}