{"id":809722,"date":"2026-05-19T09:10:11","date_gmt":"2026-05-19T09:10:11","guid":{"rendered":"https:\/\/www.ninjaone.com\/?post_type=script_hub&#038;p=809722"},"modified":"2026-05-19T09:10:11","modified_gmt":"2026-05-19T09:10:11","slug":"gerar-um-relatorio-de-lan-sem-fio-powershell","status":"publish","type":"script_hub","link":"https:\/\/www.ninjaone.com\/pt-br\/script-hub\/gerar-um-relatorio-de-lan-sem-fio-powershell\/","title":{"rendered":"Como gerar um relat\u00f3rio abrangente de LAN sem fio usando o PowerShell"},"content":{"rendered":"<p>Os relat\u00f3rios de LAN sem fio s\u00e3o indispens\u00e1veis no setor de TI. A capacidade de entender de forma r\u00e1pida e eficiente o estado, o desempenho e as poss\u00edveis vulnerabilidades de seguran\u00e7a das redes sem fio \u00e9 vital para as empresas, grandes ou pequenas. Por meio de um script do PowerShell bem estruturado, \u00e9 poss\u00edvel fazer isso sem problemas, oferecendo aos profissionais de TI e aos <a href=\"https:\/\/www.ninjaone.com\/what-is-an-msp\/\">provedores de servi\u00e7os gerenciados (MSPs)<\/a> a capacidade de\u00a0<strong>gerar um relat\u00f3rio abrangente da LAN sem fio<\/strong><\/p>\n<h2>Hist\u00f3rico<\/h2>\n<p>Em uma \u00e9poca em que o tempo de atividade e a seguran\u00e7a da rede s\u00e3o fundamentais, a capacidade de gerar um relat\u00f3rio de <a href=\"https:\/\/www.ninjaone.com\/it-hub\/remote-access\/what-is-wlan\/\">LAN sem fio<\/a>se torna uma necessidade. Esses relat\u00f3rios ajudam os profissionais de TI a monitorar a integridade de suas redes, compreender o comportamento do usu\u00e1rio e detectar poss\u00edveis anomalias que possam indicar viola\u00e7\u00f5es de seguran\u00e7a. Para os MSPs que gerenciam redes de v\u00e1rios clientes, esses relat\u00f3rios oferecem uma maneira tang\u00edvel de mostrar o trabalho realizado e os insights obtidos. O script fornecido \u00e9 uma ferramenta que pode ser aproveitada pelos profissionais de TI para automatizar e simplificar esse processo de gera\u00e7\u00e3o de relat\u00f3rios, aproveitando o poder do script do PowerShell.<\/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    Saves a Wireless LAN report to a Multi-Line Custom Field.\r\n.DESCRIPTION\r\n    Saves a Wireless LAN report to a Multi-Line Custom Field.\r\n.EXAMPLE\r\n     -CustomField \"wlanreport\"\r\n    Saves a Wireless LAN report to a Multi-Line Custom Field.\r\n.OUTPUTS\r\n    None\r\n.NOTES\r\n    Minimum OS Architecture Supported: Windows 10, Windows Server 2016\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#&gt;\r\n\r\n[CmdletBinding()]\r\nparam (\r\n    [Parameter()]\r\n    [String]\r\n    $CustomField = \"wlanreport\"\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    if ($env:CustomField) {\r\n        # Use Script Variable and overwrite parameter\r\n        $CustomField = $env:CustomField\r\n    }\r\n    $WLanReportXmlPath = \"C:ProgramDataMicrosoftWindowsWlanReportwlan-report-latest.xml\"\r\n    # Generate the wlan report\r\n    netsh.exe wlan show wlanreport | Out-Null\r\n    # Check that the xml report exists\r\n    if (-not $(Test-Path -Path $WLanReportXmlPath)) {\r\n        Write-Host \"[Error] $WLanReportXmlPath was not created by: netsh.exe wlan show wlanreport\"\r\n        exit 1\r\n    }\r\n    # Convert the report from XML to a hash table\r\n    $WLanReport = [xml[]]$(Get-Content -Raw -Path $WLanReportXmlPath) | ConvertFrom-Xml\r\n    # Get the date that the report was generated\r\n    $ReportDate = [DateTime]::ParseExact($WLanReport.WlanReport.ReportInformation.ReportDate -replace 'Z', \"yyyy'-'MM'-'dd'T'HH':'mm':'ss\", $null)\r\n    # Collect data into one variable\r\n    $Report = if ($WLanReport) {\r\n        # Output the date of the report\r\n        Write-Output \"Report Date : $ReportDate\"\r\n        # Output the user information\r\n        $WLanReport.WlanReport.UserInformation | Format-Table\r\n        # Output the saved Access Points\r\n        $WLanReport.WlanReport.Profiles.'Wi-Fi'.Keys | ForEach-Object {\r\n            $AccessPointName = $_\r\n            $AccessPointData = [xml[]]$WLanReport.WlanReport.Profiles.'Wi-Fi'.\"$AccessPointName\"\r\n            if ($null -ne $AccessPointData) {\r\n                $AccessPoint = $AccessPointData | ConvertFrom-Xml\r\n                [PSCustomObject]@{\r\n                    AccessPointName  = $AccessPointName\r\n                    Authentication   = $AccessPoint.\"$AccessPointName\".MSM.security.authEncryption.authentication\r\n                    Encryption       = $AccessPoint.\"$AccessPointName\".MSM.security.authEncryption.encryption\r\n                    MacRandomization = $AccessPoint.\"$AccessPointName\".MacRandomization.enableRandomization\r\n                }\r\n            }\r\n        } | Format-Table\r\n        \r\n        # Output the system information\r\n        $WLanReport.WlanReport.SystemInformation.Keys | ForEach-Object {\r\n            $Data = $($WLanReport.WlanReport.SystemInformation.\"$($_)\")\r\n            if ($Data -is \"String\") {\r\n                Write-Output \"$_ : $Data\"\r\n            }\r\n        }\r\n        # Output network adapters\r\n        Get-NetAdapter | Format-Table Name, InterfaceDescription, Status, MacAddress, LinkSpeed, MediaType\r\n    }\r\n    else {\r\n        $null\r\n    }\r\n\r\n    if ($Report) {\r\n        # Output report to Activity Feed\r\n        $Report | Out-String | Write-Host\r\n        # Save report to multi-line custom field\r\n        Ninja-Property-Set -Name $CustomField -Value $($Report | Out-String)\r\n    }\r\n    else {\r\n        Write-Host \"Could not generate wlan report.\"\r\n        exit 1\r\n    }\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        $p.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)\r\n    }\r\n    function ConvertFrom-Xml {\r\n        param([parameter(Mandatory, ValueFromPipeline)] [System.Xml.XmlNode] $node)\r\n        process {\r\n            if ($node.DocumentElement) { $node = $node.DocumentElement }\r\n            $oht = [ordered] @{}\r\n            $name = $node.Name\r\n            if ($node.FirstChild -is [system.xml.xmltext]) {\r\n                $oht.$name = $node.FirstChild.InnerText\r\n            }\r\n            else {\r\n                $oht.$name = New-Object System.Collections.ArrayList \r\n                foreach ($child in $node.ChildNodes) {\r\n                    $null = $oht.$name.Add((ConvertFrom-Xml $child))\r\n                }\r\n            }\r\n            $oht\r\n        }\r\n    }\r\n}\r\nend {\r\n    $ScriptVariables = @(\r\n        [PSCustomObject]@{\r\n            name           = \"CustomField\"\r\n            calculatedName = \"customfield\"\r\n            required       = $true\r\n            defaultValue   = [PSCustomObject]@{\r\n                type  = \"TEXT\"\r\n                value = \"wlanreport\"\r\n            }\r\n            valueType      = \"TEXT\" # Must be uppercase!\r\n            valueList      = $null\r\n            description    = \"A multi-line Custom Field that the report will be saved to.\"\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>O script come\u00e7a verificando a vers\u00e3o necess\u00e1ria, que \u00e9 a 5.1, garantindo a compatibilidade. Em seguida, s\u00e3o fornecidos uma sinopse, uma descri\u00e7\u00e3o e exemplos, oferecendo uma explica\u00e7\u00e3o sucinta do objetivo do script.<\/p>\n<p>Em seguida, os par\u00e2metros s\u00e3o definidos para o script, sendo o padr\u00e3o <strong>&#8220;wlanreport&#8221;<\/strong> No bloco &#8220;processo&#8221;, o script verifica se h\u00e1 privil\u00e9gios elevados. Sem direitos de administrador, o script n\u00e3o ser\u00e1 executado. Em seguida, ele verifica se h\u00e1 uma vari\u00e1vel de ambiente chamada <strong>&#8220;CustomField&#8221;<\/strong> Se for encontrado, ele substituir\u00e1 o par\u00e2metro do script.<\/p>\n<p>A parte principal do script gera o relat\u00f3rio da WLAN por meio do comando netsh.exe wlan show wlanreport e, em seguida, verifica se o relat\u00f3rio foi criado com \u00eaxito. Ap\u00f3s a valida\u00e7\u00e3o, ele converte esse relat\u00f3rio XML em uma tabela de hash mais leg\u00edvel, extrai dados \u00fateis, como informa\u00e7\u00f5es do usu\u00e1rio, pontos de acesso e informa\u00e7\u00f5es do sistema, e os formata de forma adequada em um formato de tabela.<\/p>\n<p>O bloco final do script define algumas fun\u00e7\u00f5es personalizadas, como Test-IsElevated, que verifica se o script \u00e9 executado com direitos elevados, e ConvertFrom-Xml, uma fun\u00e7\u00e3o para converter dados XML.<\/p>\n<h2>Casos de uso em potencial<\/h2>\n<p>Imagine Sarah, uma profissional de TI em uma empresa de m\u00e9dio porte. Recentemente, o escrit\u00f3rio sofreu algumas flutua\u00e7\u00f5es na rede e a tarefa de Sarah \u00e9 diagnosticar qualquer problema com a <a href=\"https:\/\/www.ninjaone.com\/it-hub\/remote-access\/what-is-wlan\/\">WLAN<\/a>. Usando esse script, ela pode gerar rapidamente um relat\u00f3rio detalhado da WLAN, revelando dados relacionados a conex\u00f5es de usu\u00e1rios, pontos de acesso ativos e detalhes do sistema, ajudando-a a identificar a causa raiz do problema.<\/p>\n<h2>Compara\u00e7\u00f5es<\/h2>\n<p>Tradicionalmente, a gera\u00e7\u00e3o de um relat\u00f3rio de WLAN envolveria interven\u00e7\u00f5es manuais, usando ferramentas integradas do sistema operacional, software de terceiros ou at\u00e9 mesmo ferramentas de hardware. Embora esses m\u00e9todos ainda sejam v\u00e1lidos, o <a href=\"https:\/\/www.ninjaone.com\/blog\/generate-a-wireless-lan-report-powershell\/\">script do PowerShell<\/a> fornecido <a href=\"https:\/\/www.ninjaone.com\/blog\/generate-a-wireless-lan-report-powershell\/\">oferece automa\u00e7\u00e3o<\/a>, velocidade e consist\u00eancia, o que \u00e9 especialmente vantajoso para os MSPs que gerenciam v\u00e1rias redes e precisam de uma abordagem padronizada.<\/p>\n<h2>Implica\u00e7\u00f5es<\/h2>\n<p>Embora o script ajude a gerar relat\u00f3rios abrangentes de WLAN, os usu\u00e1rios devem entender seus resultados para tomar decis\u00f5es de seguran\u00e7a significativas. Deixar de observar detalhes espec\u00edficos ou interpretar mal os dados pode fazer com que as vulnerabilidades de seguran\u00e7a passem despercebidas.<\/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\">Sempre execute o script com as permiss\u00f5es necess\u00e1rias.<\/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=\"2\" data-aria-level=\"1\">Certifique-se de que sua vers\u00e3o do PowerShell seja compat\u00edvel.<\/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=\"2\" data-aria-level=\"1\">Analise e interprete regularmente os relat\u00f3rios gerados para tomar decis\u00f5es eficazes.<\/li>\n<\/ul>\n<h2>Considera\u00e7\u00f5es finais<\/h2>\n<p>Para os profissionais de TI, <a href=\"https:\/\/ninjaone.com\/\" target=\"_blank\" rel=\"noopener\">o NinjaOne<\/a> oferece uma <a href=\"https:\/\/www.ninjaone.com\/pt-br\/blog\/single-pane-of-glass-software-explained\/\">plataforma centralizada para gerenciar a infraestrutura de TI<\/a>. O acoplamento desse script com os recursos do NinjaOne pode aprimorar o monitoramento, o gerenciamento e a gera\u00e7\u00e3o de relat\u00f3rios sobre redes sem fio, fornecendo uma abordagem hol\u00edstica para o <a href=\"https:\/\/www.ninjaone.com\/pt-br\/endpoint-management\/gerenciamento-de-rede\/\">gerenciamento de redes de TI<\/a>.\u00a0Ao aproveitar ferramentas como o script do PowerShell fornecido, os profissionais de TI podem trabalhar de forma mais inteligente, e n\u00e3o mais dif\u00edcil, garantindo que suas redes estejam sempre com o melhor desempenho.<\/p>\n","protected":false},"author":35,"featured_media":144013,"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":[12460],"class_list":["post-809722","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\/809722","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=809722"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/pt-br\/wp-json\/wp\/v2\/media\/144013"}],"wp:attachment":[{"href":"https:\/\/www.ninjaone.com\/pt-br\/wp-json\/wp\/v2\/media?parent=809722"}],"wp:term":[{"taxonomy":"script_hub_category","embeddable":true,"href":"https:\/\/www.ninjaone.com\/pt-br\/wp-json\/wp\/v2\/operating_system?post=809722"},{"taxonomy":"use_cases","embeddable":true,"href":"https:\/\/www.ninjaone.com\/pt-br\/wp-json\/wp\/v2\/use_cases?post=809722"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}