{"id":208123,"date":"2023-09-27T12:01:09","date_gmt":"2023-09-27T12:01:09","guid":{"rendered":"https:\/\/www.ninjaone.com\/script-hub\/configurare-le-impostazioni-uac-windows-powershell-2\/"},"modified":"2024-07-24T13:52:21","modified_gmt":"2024-07-24T13:52:21","slug":"configurare-le-impostazioni-uac-windows-powershell-2","status":"publish","type":"script_hub","link":"https:\/\/www.ninjaone.com\/it\/script-hub\/configurare-le-impostazioni-uac-windows-powershell-2\/","title":{"rendered":"Come configurare le impostazioni UAC di Windows (script PowerShell)"},"content":{"rendered":"<p><span class=\"TextRun SCXW83147543 BCX0\" lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW83147543 BCX0\">Il <a href=\"https:\/\/www.ninjaone.com\/it-hub\/endpoint-security\/what-is-user-account-control-uac\/\">controllo dell&#8217;account utente (UAC)<\/a> \u00e8 una funzione di sicurezza fondamentale nei sistemi operativi Windows. Agisce come un gatekeeper, impedendo modifiche non autorizzate al tuo computer. UAC funziona definendo <\/span><span class=\"NormalTextRun SCXW83147543 BCX0\">diversi livelli<\/span><span class=\"NormalTextRun SCXW83147543 BCX0\"> di autorizzazioni per gli utenti, che vanno dal notificare qualsiasi modifica al non notificarne nessuna. Comprendendo questi livelli e il modo in cui le impostazioni UAC influiscono sulle autorizzazioni degli utenti, i professionisti IT possono proteggere meglio i loro sistemi.<\/span><\/span><span class=\"EOP SCXW83147543 BCX0\" data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<h2>Background<\/h2>\n<p><span class=\"NormalTextRun SCXW22906316 BCX0\">Introdotto con Windows Vista, UAC \u00e8 stato un pilastro della sicurezza di Windows. Quando <\/span><span class=\"NormalTextRun SCXW22906316 BCX0\">c\u2019\u00e8 un tentativo<\/span><span class=\"NormalTextRun SCXW22906316 BCX0\"> di effettuare una modifica, UAC chiede agli utenti l&#8217;autorizzazione o la password di amministratore prima di consentire l&#8217;<\/span><span class=\"NormalTextRun SCXW22906316 BCX0\">operazione<\/span><span class=\"NormalTextRun SCXW22906316 BCX0\">. Questo script, realizzato su misura per Windows 7 e Windows Server 2012, offre un modo per <strong>configurare programmaticamente le impostazioni UAC<\/strong>.<\/span><\/p>\n<h2>Lo script per configurare le impostazioni UAC<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\">#Requires -Version 2.0\r\n\r\n&lt;#\r\n.SYNOPSIS\r\n    Configures UAC.\r\n.DESCRIPTION\r\n    Configures UAC to defaults if no parameters are specified.\r\n.EXAMPLE\r\n    No parameters needed.\r\n    Sets all UAC settings to Microsoft's defaults.\r\n.EXAMPLE\r\n     -ConsentPromptBehaviorAdmin 5\r\n    Sets ConsentPromptBehaviorAdmin to 5\r\n.EXAMPLE\r\n    PS C:&gt; Set-Uac.ps1\r\n    Sets all UAC settings to MS defaults.\r\n.OUTPUTS\r\n    None\r\n.NOTES\r\n    Minimum OS Architecture Supported: Windows 7, Windows Server 2012\r\n    This script will show before and after UAC settings.\r\n    Release Notes:\r\n    Initial Release\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.COMPONENT\r\n    LocalUserAccountManagement\r\n#&gt;\r\n\r\n[CmdletBinding()]\r\nparam (\r\n    [Parameter()][ValidateRange(0, 5)][int]$ConsentPromptBehaviorAdmin = 5,\r\n    [Parameter()][ValidateRange(0, 3)][int]$ConsentPromptBehaviorUser = 3,\r\n    [Parameter()][ValidateRange(0, 1)][int]$EnableInstallerDetection = 1,\r\n    [Parameter()][ValidateRange(0, 1)][int]$EnableLUA = 1,\r\n    [Parameter()][ValidateRange(0, 1)][int]$EnableVirtualization = 1,\r\n    [Parameter()][ValidateRange(0, 1)][int]$PromptOnSecureDesktop = 1,\r\n    [Parameter()][ValidateRange(0, 1)][int]$ValidateAdminCodeSignatures = 0,\r\n    [Parameter()][ValidateRange(0, 1)][int]$FilterAdministratorToken = 0\r\n)\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        if ($p.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator))\r\n        { Write-Output $true }\r\n        else\r\n        { Write-Output $false }\r\n    }\r\n    function Set-ItemProp {\r\n        param (\r\n            $Path,\r\n            $Name,\r\n            $Value,\r\n            [ValidateSet(\"DWord\", \"QWord\", \"String\", \"ExpandedString\", \"Binary\", \"MultiString\", \"Unknown\")]\r\n            $PropertyType = \"DWord\"\r\n        )\r\n        if ((Get-ItemProperty -Path $Path -Name $Name -ErrorAction SilentlyContinue)) {\r\n            Set-ItemProperty -Path $Path -Name $Name -Value $Value -Force -Confirm:$false | Out-Null\r\n        }\r\n        else {\r\n            New-ItemProperty -Path $Path -Name $Name -Value $Value -PropertyType $PropertyType -Force -Confirm:$false | Out-Null\r\n        }\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    $path = \"HKLM:SOFTWAREMicrosoftWindowsCurrentVersionPoliciesSystem\"\r\n    $filter = \"ConsentPromptBehaviorAdmin|ConsentPromptBehaviorUser|EnableInstallerDetection|EnableLUA|EnableVirtualization|PromptOnSecureDesktop|ValidateAdminCodeSignatures|FilterAdministratorToken\"\r\n    Write-Host \"Before:\"\r\n    (Get-ItemProperty $path).psobject.properties | Where-Object { $_.name -match $filter } | Select-Object name, value\r\n\r\n    try {\r\n        $filter -split '|' | ForEach-Object {\r\n            Set-ItemProp -Path $Path -Name $_ -Value (Get-Variable -Name $_).Value\r\n        }\r\n    }\r\n    catch {\r\n        Write-Error $_\r\n        exit 1\r\n    }\r\n\r\n    Write-Host \"After:\"\r\n    (Get-ItemProperty $path).psobject.properties | Where-Object { $_.name -match $filter } | Select-Object name, value\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>Situazioni d&#8217;uso potenziali<\/h2>\n<p><span class=\"NormalTextRun SCXW127349269 BCX0\">Immagina uno scenario in cui un&#8217;azienda sta distribuendo un nuovo software che richiede impostazioni UAC specifiche al fine di ottenere <\/span>prestazioni e sicurezza<span class=\"NormalTextRun SCXW127349269 BCX0\">ottimali<\/span><span class=\"NormalTextRun SCXW127349269 BCX0\">. Invece di configurare manualmente ogni computer, il team IT pu\u00f2 utilizzare questo script per garantire che ogni macchina sia impostata correttamente. Inoltre, per le aziende che devono attenersi a rigide norme di sicurezza, questo script pu\u00f2 contribuire a garantire la conformit\u00e0 standardizzando le impostazioni UAC ovunque.<\/span><\/p>\n<h2>Domande frequenti<\/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=\"none\">Quali sistemi operativi supportano questo script?<\/span><br \/>\n<span data-contrast=\"none\">Lo script per configurare le impostazioni UAC \u00e8 progettato per Windows 7, Windows Server 2012 e versioni successive.<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;201341983&quot;:0,&quot;335559738&quot;:0,&quot;335559739&quot;:0,&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=\"none\">Quali autorizzazioni sono necessarie per eseguire lo script?<\/span><br \/>\n<span data-contrast=\"none\">Lo script per configurare le impostazioni UAC deve essere eseguito con privilegi amministrativi.<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;201341983&quot;:0,&quot;335559738&quot;:0,&quot;335559739&quot;:0,&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=\"none\">Ci sono rischi associati all&#8217;uso di questo script?<\/span><br \/>\n<span data-contrast=\"none\">Come per ogni script che modifica le impostazioni di sistema, \u00e8 possibile che si verifichino conseguenze indesiderate. Esegui sempre il backup e il test prima di una distribuzione diffusa.<\/span><\/li>\n<\/ul>\n<h2>Implicazioni per la sicurezza<\/h2>\n<p><span class=\"TextRun SCXW168748259 BCX0\" lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW168748259 BCX0\">Le impostazioni UAC svolgono un ruolo fondamentale per la sicurezza del sistema. Impostazioni UAC errate possono inavvertitamente dare il via libera all&#8217;installazione o all&#8217;esecuzione di malware senza l&#8217;autorizzazione dell&#8217;utente. Automatizzando il processo di configurazione, questo script riduce le possibilit\u00e0 di errore umano, ma rende ancora maggiore l&#8217;importanza di comprendere le implicazioni di ciascuna impostazione.<\/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=\"none\">Esegui sempre un backup del registro prima di apportare modifiche per evitare potenziali problemi.<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;201341983&quot;:0,&quot;335559738&quot;:0,&quot;335559739&quot;:0,&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=\"none\">Testa lo script per configurare le impostazioni UAC su un singolo computer o in un ambiente controllato prima di distribuirlo in tutta la rete.<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;201341983&quot;:0,&quot;335559738&quot;:0,&quot;335559739&quot;:0,&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=\"none\">Rimani aggiornato sulle best practice per configurare le impostazioni UAC, al fine di garantire una sicurezza ottimale.<\/span><\/li>\n<\/ul>\n<h2>Considerazioni finali<\/h2>\n<p><span class=\"NormalTextRun SCXW16747520 BCX0\">Nel panorama in continua evoluzione della sicurezza informatica, strumenti come questo script per configurare le impostazioni UAC sono preziosi. Comprendendo e <\/span><span class=\"NormalTextRun SCXW16747520 BCX0\">sfruttando<\/span><span class=\"NormalTextRun SCXW16747520 BCX0\"> tali strumenti, i professionisti IT possono garantire un ambiente pi\u00f9 sicuro ed efficiente per i propri utenti.<\/span><\/p>\n","protected":false},"author":35,"featured_media":207137,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"_relevanssi_hide_post":"","_relevanssi_hide_content":"","_relevanssi_pin_for_all":"","_relevanssi_pin_keywords":"","_relevanssi_unpin_keywords":"","_relevanssi_related_keywords":"","_relevanssi_related_include_ids":"","_relevanssi_related_exclude_ids":"","_relevanssi_related_no_append":"","_relevanssi_related_not_related":"","_relevanssi_related_posts":"","_relevanssi_noindex_reason":"","_lmt_disableupdate":"no","_lmt_disable":""},"operating_system":[4212],"use_cases":[4275],"class_list":["post-208123","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\/208123","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=208123"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/it\/wp-json\/wp\/v2\/media\/207137"}],"wp:attachment":[{"href":"https:\/\/www.ninjaone.com\/it\/wp-json\/wp\/v2\/media?parent=208123"}],"wp:term":[{"taxonomy":"script_hub_category","embeddable":true,"href":"https:\/\/www.ninjaone.com\/it\/wp-json\/wp\/v2\/operating_system?post=208123"},{"taxonomy":"use_cases","embeddable":true,"href":"https:\/\/www.ninjaone.com\/it\/wp-json\/wp\/v2\/use_cases?post=208123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}