{"id":208625,"date":"2024-01-31T16:45:03","date_gmt":"2024-01-31T16:45:03","guid":{"rendered":"https:\/\/www.ninjaone.com\/script-hub\/ajustar-configuracion-de-uac-para-windows\/"},"modified":"2024-03-04T19:01:12","modified_gmt":"2024-03-04T19:01:12","slug":"ajustar-configuracion-de-uac-para-windows","status":"publish","type":"script_hub","link":"https:\/\/www.ninjaone.com\/es\/script-hub\/ajustar-configuracion-de-uac-para-windows\/","title":{"rendered":"C\u00f3mo ajustar la configuraci\u00f3n de UAC para Windows (script de PowerShell)"},"content":{"rendered":"<p><a href=\"https:\/\/www.ninjaone.com\/blog\/what-is-user-account-control-uac\/\">El control de cuentas de usuario (UAC)<\/a> es una funci\u00f3n de seguridad clave en los sistemas operativos Windows, que act\u00faa como un guardi\u00e1n, impidiendo cambios no autorizados en tu ordenador. El UAC funciona definiendo diferentes niveles de permisos de usuario, que van desde notificar siempre los cambios hasta no hacerlo nunca. Si comprenden estos niveles y la forma en que la configuraci\u00f3n de UAC afecta a los permisos de usuario, los profesionales de TI pueden proteger mejor sus sistemas.<\/p>\n<h2>Antecedentes<\/h2>\n<p>Introducido con Windows Vista, el UAC ha sido una piedra angular de la seguridad de Windows. Cuando se intenta realizar ciertos cambios, el UAC pide permiso a los usuarios o una contrase\u00f1a de administrador antes de permitir que la tarea contin\u00fae. Este script, adaptado para Windows 7 y Windows Server 2012 en adelante, ofrece una forma de <strong>ajustar mediante programaci\u00f3n esta configuraci\u00f3n de UAC<\/strong>.<\/p>\n<h2>El script para ajustar la configuraci\u00f3n de UAC para Windows<\/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>Accede a m\u00e1s de 300 scripts en el Dojo de NinjaOne<\/p>\n<p><a href=\"https:\/\/www.ninjaone.com\/es\/prueba-gratuita-formulario\/\">Obt\u00e9n acceso<\/a><\/p>\n<\/div>\n<h2>Posibles casos de uso<\/h2>\n<p>Imagina un escenario en el que una empresa est\u00e1 desplegando un nuevo software que requiere una configuraci\u00f3n de UAC espec\u00edfica para un rendimiento y seguridad \u00f3ptimos. En lugar de configurar manualmente cada ordenador, el equipo inform\u00e1tico puede utilizar este script para asegurarse de que cada m\u00e1quina est\u00e1 configurada correctamente. Adem\u00e1s, para las empresas que necesitan adherirse a estrictas normas de seguridad, este script puede ayudar a garantizar el cumplimiento mediante la estandarizaci\u00f3n de la configuraci\u00f3n de UAC en todos los \u00e1mbitos.<\/p>\n<h2>Preguntas frecuentes<\/h2>\n<ul>\n<li>\u00bfQu\u00e9 sistemas operativos admiten este script?<br \/>\nEl script est\u00e1 dise\u00f1ado para Windows 7, Windows Server 2012 y versiones posteriores.<\/li>\n<li>\u00bfQu\u00e9 permisos se necesitan para ejecutar el script?<br \/>\nEl script debe ejecutarse con privilegios administrativos.<\/li>\n<li>\u00bfExisten riesgos asociados al uso de este script?<br \/>\nComo ocurre con cualquier script que modifica la configuraci\u00f3n del sistema, existe la posibilidad de que se produzcan consecuencias no deseadas. Haz siempre copias de seguridad y pruebas antes de la implantaci\u00f3n total.<\/li>\n<\/ul>\n<h2>Implicaciones para la seguridad<\/h2>\n<p>La configuraci\u00f3n de UAC desempe\u00f1a un papel fundamental en la seguridad del sistema. Una configuraci\u00f3n incorrecta puede dar inadvertidamente luz verde al malware para que se instale o ejecute sin permiso del usuario. Al automatizar el proceso de configuraci\u00f3n, este script reduce las posibilidades de error humano, pero hace a\u00fan m\u00e1s importante comprender las implicaciones de cada ajuste.<\/p>\n<h2>Recomendaciones<\/h2>\n<ul>\n<li>Haz siempre una copia de seguridad del registro antes de realizar cambios para evitar posibles problemas.<\/li>\n<li>Prueba el script en una sola m\u00e1quina o en un entorno controlado antes de desplegarlo en toda la red.<\/li>\n<li>Mantente al d\u00eda sobre las mejores pr\u00e1cticas para ajustar la configuraci\u00f3n de UAC para garantizar una seguridad \u00f3ptima.<\/li>\n<\/ul>\n<h2>Reflexiones finales<\/h2>\n<p>En el panorama en constante evoluci\u00f3n de la seguridad inform\u00e1tica, herramientas como este script para ajustar la configuraci\u00f3n de UAC tienen un valor incalculable. Al conocer y usar estas herramientas, los profesionales de TI pueden garantizar un entorno m\u00e1s seguro y eficiente para sus usuarios.<\/p>\n","protected":false},"author":35,"featured_media":207142,"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":[4265],"class_list":["post-208625","script_hub","type-script_hub","status-publish","has-post-thumbnail","hentry","script_hub_category-windows"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.ninjaone.com\/es\/wp-json\/wp\/v2\/script_hub\/208625","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ninjaone.com\/es\/wp-json\/wp\/v2\/script_hub"}],"about":[{"href":"https:\/\/www.ninjaone.com\/es\/wp-json\/wp\/v2\/types\/script_hub"}],"author":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/es\/wp-json\/wp\/v2\/users\/35"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/es\/wp-json\/wp\/v2\/comments?post=208625"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/es\/wp-json\/wp\/v2\/media\/207142"}],"wp:attachment":[{"href":"https:\/\/www.ninjaone.com\/es\/wp-json\/wp\/v2\/media?parent=208625"}],"wp:term":[{"taxonomy":"script_hub_category","embeddable":true,"href":"https:\/\/www.ninjaone.com\/es\/wp-json\/wp\/v2\/operating_system?post=208625"},{"taxonomy":"use_cases","embeddable":true,"href":"https:\/\/www.ninjaone.com\/es\/wp-json\/wp\/v2\/use_cases?post=208625"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}