{"id":811715,"date":"2026-05-25T07:09:25","date_gmt":"2026-05-25T07:09:25","guid":{"rendered":"https:\/\/www.ninjaone.com\/?post_type=script_hub&#038;p=811715"},"modified":"2026-05-25T07:09:25","modified_gmt":"2026-05-25T07:09:25","slug":"como-alterar-as-mensagens-de-login-no-powershell","status":"publish","type":"script_hub","link":"https:\/\/www.ninjaone.com\/pt-br\/script-hub\/como-alterar-as-mensagens-de-login-no-powershell\/","title":{"rendered":"Como alterar as mensagens de login no Windows usando o PowerShell"},"content":{"rendered":"<h2>Principais conclus\u00f5es<\/h2>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" 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;}\" data-aria-posinset=\"1\" data-aria-level=\"1\">A personaliza\u00e7\u00e3o das mensagens de login do Windows aumenta a seguran\u00e7a e a experi\u00eancia do usu\u00e1rio.<\/li>\n<li>O script do PowerShell fornecido oferece um m\u00e9todo r\u00e1pido para atualizar t\u00edtulos e mensagens de login.<\/li>\n<li>Os privil\u00e9gios de administrador s\u00e3o necess\u00e1rios devido a altera\u00e7\u00f5es no registro do sistema.<\/li>\n<li>O script \u00e9 compat\u00edvel com o Windows 10 e o Windows Server 2016 em diante.<\/li>\n<li>Embora os objetos de pol\u00edtica de grupo possam executar tarefas semelhantes, esse script oferece ajustes mais r\u00e1pidos e \u00e1geis.<\/li>\n<li>O uso indevido, como o compartilhamento de informa\u00e7\u00f5es confidenciais por meio de mensagens de login, pode representar amea\u00e7as \u00e0 seguran\u00e7a.<\/li>\n<li>Sempre teste o script em um ambiente de \u00e1rea restrita antes da ampla implementa\u00e7\u00e3o.<\/li>\n<li>Plataformas como o NinjaOne facilitam ainda mais o gerenciamento e a implementa\u00e7\u00e3o de tais scripts em grandes redes.<\/li>\n<\/ul>\n<p>Com um cen\u00e1rio em constante evolu\u00e7\u00e3o de necessidades de seguran\u00e7a e aprimoramento da experi\u00eancia do usu\u00e1rio, os administradores de TI se veem em busca de ferramentas mais refinadas para gerenciar sistemas de forma eficaz. Uma \u00e1rea frequentemente ignorada, mas essencial, \u00e9 a personaliza\u00e7\u00e3o das mensagens de login no Windows. A capacidade de <strong>alterar as mensagens de login no Windows<\/strong>\u00a0\u00e9 vital, pois pode comunicar as informa\u00e7\u00f5es necess\u00e1rias aos usu\u00e1rios, refor\u00e7ar a seguran\u00e7a e fornecer uma camada de personaliza\u00e7\u00e3o em um ambiente corporativo.<\/p>\n<h2>Hist\u00f3rico<\/h2>\n<p>Nosso ponto focal para a discuss\u00e3o de hoje \u00e9 um script do PowerShell desenvolvido para atualizar a mensagem de login nos sistemas Windows. Esse script pequeno, mas eficiente, destaca uma combina\u00e7\u00e3o de seguran\u00e7a e aprimoramento da experi\u00eancia do usu\u00e1rio. Ao controlar o t\u00edtulo e a mensagem que os usu\u00e1rios veem no momento do login, os profissionais de TI e <a href=\"https:\/\/www.ninjaone.com\/what-is-an-msp\/\">os provedores de servi\u00e7os gerenciados (MSPs)<\/a> podem transmitir atualiza\u00e7\u00f5es cr\u00edticas, avisos ou apenas fornecer coes\u00e3o de marca em toda a frota de m\u00e1quinas sob sua al\u00e7ada.<\/p>\n<h2>O roteiro<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\">#Requires -Version 5.1\r\n\r\n&lt;#\r\n.SYNOPSIS\r\n    Changes the logon title and message.\r\n.DESCRIPTION\r\n    Changes the logon title and message.\r\n.EXAMPLE\r\n     -Title \"My Title\" -Message \"My Logon Message\"\r\n    Set the title and message.\r\n.EXAMPLE\r\n    PS C:&gt; Set-LogonMessage.ps1 -Title \"My Title\" -Message \"My Logon Message\"\r\n    Set the title and message.\r\n.OUTPUTS\r\n    None\r\n.NOTES\r\n    Minimum OS Architecture Supported: Windows 10, Windows Server 2016\r\n    Release Notes: Renamed script and added Script Variable support, updated Set-ItemProp\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    OSSecurity\r\n#&gt;\r\n\r\n[CmdletBinding()]\r\nparam (\r\n    [Parameter()]\r\n    [String]$Title,\r\n    [Parameter()]\r\n    [String]$Message\r\n)\r\n\r\nbegin {\r\n    if ($env:title -and $env:title -notlike \"null\") {\r\n        $Title = $env:title\r\n    }\r\n\r\n    if ($env:message -and $env:message -notlike \"null\") {\r\n        $Message = $env:Message\r\n    }\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        # Do not output errors and continue\r\n        $ErrorActionPreference = [System.Management.Automation.ActionPreference]::SilentlyContinue\r\n        if (-not $(Test-Path -Path $Path)) {\r\n            # Check if path does not exist and create the path\r\n            New-Item -Path $Path -Force | Out-Null\r\n        }\r\n        if ((Get-ItemProperty -Path $Path -Name $Name)) {\r\n        # Update property and print out what it was changed from and changed to\r\n            $CurrentValue = Get-ItemProperty -Path $Path -Name $Name\r\n            try {\r\n                Set-ItemProperty -Path $Path -Name $Name -Value $Value -Force -Confirm:$false -ErrorAction Stop | Out-Null\r\n            }\r\n            catch {\r\n                Write-Error $_\r\n            }\r\n            Write-Host \"$Path$Name changed from $CurrentValue to $(Get-ItemProperty -Path $Path -Name $Name)\"\r\n        }\r\n        else {\r\n            # Create property with value\r\n            try {\r\n                New-ItemProperty -Path $Path -Name $Name -Value $Value -PropertyType $PropertyType -Force -Confirm:$false -ErrorAction Stop | Out-Null\r\n            }\r\n            catch {\r\n                Write-Error $_\r\n            }\r\n            Write-Host \"Set $Path$Name to $(Get-ItemProperty -Path $Path -Name $Name)\"\r\n        }\r\n        $ErrorActionPreference = [System.Management.Automation.ActionPreference]::Continue\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    try {\r\n        Set-ItemProp -Path \"HKLM:SOFTWAREMicrosoftWindowsCurrentVersionPoliciesSystem\" -Name \"legalnoticecaption\" -Value $Title -PropertyType String\r\n        Set-ItemProp -Path \"HKLM:SOFTWAREMicrosoftWindowsCurrentVersionPoliciesSystem\" -Name \"legalnoticetext\" -Value $Message -PropertyType String\r\n    }\r\n    catch {\r\n        Write-Error $_\r\n        exit 1\r\n    }\r\n}\r\nend {\r\n    \r\n    \r\n    \r\n}<\/pre>\n<p>&nbsp;<\/p>\n\n<div class=\"in-context-cta\"><p style=\"text-align: center;\">Acesse mais de 300 scripts no NinjaOne Dojo<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/www.ninjaone.com\/freetrialform\/\">Obter acesso<\/a><\/p>\n<\/div>\n<h2>Detalhamento<\/h2>\n<p>Vamos nos aprofundar na mec\u00e2nica do script:<\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" 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;}\" data-aria-posinset=\"1\" data-aria-level=\"1\"><strong>Vincula\u00e7\u00e3o e par\u00e2metros do cmdlet<\/strong>: O script \u00e9 projetado como uma fun\u00e7\u00e3o do PowerShell usando o atributo CmdletBinding. Isso significa que o script pode ser usado como uma fun\u00e7\u00e3o reutiliz\u00e1vel e pode aceitar par\u00e2metros, especificamente o t\u00edtulo e a mensagem do prompt de login.<\/li>\n<li><strong>Verifica\u00e7\u00e3o do administrador<\/strong>: Duas fun\u00e7\u00f5es incorporadas s\u00e3o utilizadas, <strong>Test-IsElevated<\/strong> e <strong>Set-ItemProp<\/strong>. O primeiro verifica se o script \u00e9 executado com privil\u00e9gios de administrador, o que \u00e9 vital, pois a modifica\u00e7\u00e3o de chaves de registro (que o script faz) exige permiss\u00f5es elevadas.<\/li>\n<li><strong>Modifica\u00e7\u00f5es no registro<\/strong>: A fun\u00e7\u00e3o <strong>Set-ItemProp<\/strong> modifica os valores de registro existentes ou cria novos valores. O script tem como alvo duas chaves prim\u00e1rias, <strong>legalnoticecaption<\/strong> (para o t\u00edtulo) e <strong>legalnoticetext<\/strong> (para a mensagem), que controlam a mensagem de login no Windows.<\/li>\n<\/ul>\n<h2>Casos de uso em potencial<\/h2>\n<p>Imagine que o administrador de TI de uma corpora\u00e7\u00e3o global queira alertar todos os usu\u00e1rios sobre a pr\u00f3xima manuten\u00e7\u00e3o do servidor. Em vez de confiar em e-mails que podem ser ignorados, eles implementam esse script em todas as esta\u00e7\u00f5es de trabalho. Quando os funcion\u00e1rios fazem login no dia seguinte, eles s\u00e3o recebidos com o alerta, garantindo o m\u00e1ximo de visibilidade.<\/p>\n<h2>Compara\u00e7\u00f5es<\/h2>\n<p>Embora <a href=\"https:\/\/www.techtarget.com\/searchwindowsserver\/definition\/Group-Policy-Object\/\" target=\"_blank\" rel=\"noopener\">os objetos de pol\u00edtica de grupo (GPO)<\/a> tamb\u00e9m possam ser usados para definir mensagens de login, esse script oferece uma abordagem mais \u00e1gil. As GPOs podem levar tempo para se propagar e podem n\u00e3o ser adequadas para mudan\u00e7as r\u00e1pidas. O script do PowerShell, por outro lado, pode ser executado rapidamente m\u00e1quina por m\u00e1quina ou implantado amplamente por meio de uma ferramenta de gerenciamento de sistema.<\/p>\n<h2>Implica\u00e7\u00f5es<\/h2>\n<p>Embora o script ajude na comunica\u00e7\u00e3o e na marca, seu uso incorreto pode resultar em confus\u00e3o ou at\u00e9 mesmo em poss\u00edveis problemas de seguran\u00e7a. N\u00e3o \u00e9 recomend\u00e1vel transmitir informa\u00e7\u00f5es confidenciais em uma mensagem de login. Al\u00e9m disso, mudan\u00e7as frequentes podem dessensibilizar os usu\u00e1rios em rela\u00e7\u00e3o a essas mensagens, potencialmente diluindo seu impacto.<\/p>\n<h2>Recomenda\u00e7\u00f5es<\/h2>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" 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;}\" data-aria-posinset=\"1\" data-aria-level=\"1\">Garanta clareza e brevidade em suas mensagens de login.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" 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;}\" data-aria-posinset=\"1\" data-aria-level=\"1\">Teste o script em um ambiente controlado antes de uma ampla implementa\u00e7\u00e3o.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" 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;}\" data-aria-posinset=\"1\" data-aria-level=\"1\">Mantenha <a href=\"https:\/\/www.ninjaone.com\/blog\/back-up-and-restore-windows-registry\/\">backups<\/a> regulares <a href=\"https:\/\/www.ninjaone.com\/blog\/back-up-and-restore-windows-registry\/\">do registro do sistema<\/a>.<\/li>\n<\/ul>\n<h2>Considera\u00e7\u00f5es finais<\/h2>\n<p>O uso de ferramentas como esse script \u00e9 apenas um fragmento do kit de ferramentas <a href=\"https:\/\/www.ninjaone.com\/pt-br\/rmm\/software-de-gerenciamento-de-operacoes-de-ti\/\">abrangente de gerenciamento de TI<\/a>. Plataformas como o NinjaOne ampliam esses esfor\u00e7os, fornecendo um ambiente integrado para <a href=\"https:\/\/www.ninjaone.com\/software-deployment\/\">implementar, gerenciar e monitorar scripts<\/a> como esse em vastas redes, garantindo consist\u00eancia, seguran\u00e7a e experi\u00eancia aprimorada do usu\u00e1rio.<\/p>\n","protected":false},"author":35,"featured_media":144888,"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":[12456],"class_list":["post-811715","script_hub","type-script_hub","status-publish","has-post-thumbnail","hentry","script_hub_category-windows"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.ninjaone.com\/pt-br\/wp-json\/wp\/v2\/script_hub\/811715","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ninjaone.com\/pt-br\/wp-json\/wp\/v2\/script_hub"}],"about":[{"href":"https:\/\/www.ninjaone.com\/pt-br\/wp-json\/wp\/v2\/types\/script_hub"}],"author":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/pt-br\/wp-json\/wp\/v2\/users\/35"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/pt-br\/wp-json\/wp\/v2\/comments?post=811715"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/pt-br\/wp-json\/wp\/v2\/media\/144888"}],"wp:attachment":[{"href":"https:\/\/www.ninjaone.com\/pt-br\/wp-json\/wp\/v2\/media?parent=811715"}],"wp:term":[{"taxonomy":"script_hub_category","embeddable":true,"href":"https:\/\/www.ninjaone.com\/pt-br\/wp-json\/wp\/v2\/operating_system?post=811715"},{"taxonomy":"use_cases","embeddable":true,"href":"https:\/\/www.ninjaone.com\/pt-br\/wp-json\/wp\/v2\/use_cases?post=811715"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}