{"id":807218,"date":"2026-05-12T09:22:23","date_gmt":"2026-05-12T09:22:23","guid":{"rendered":"https:\/\/www.ninjaone.com\/?post_type=script_hub&#038;p=807218"},"modified":"2026-05-12T09:22:23","modified_gmt":"2026-05-12T09:22:23","slug":"como-limpar-um-disco-rigido-com-o-powershell","status":"publish","type":"script_hub","link":"https:\/\/www.ninjaone.com\/pt-br\/script-hub\/como-limpar-um-disco-rigido-com-o-powershell\/","title":{"rendered":"Como limpar com seguran\u00e7a um disco r\u00edgido do Windows com o PowerShell"},"content":{"rendered":"<p>Na era atual de seguran\u00e7a de dados, o descarte adequado de dados em discos r\u00edgidos \u00e9 crucial. Para os profissionais de TI e os provedores de servi\u00e7os gerenciados (MSPs), \u00e9 essencial ter ferramentas confi\u00e1veis para essas tarefas. Nesta postagem do blog, vamos nos aprofundar nos detalhes de um <strong>script<\/strong> vers\u00e1til <strong>do PowerShell projetado para uma limpeza de disco segura e eficiente<\/strong>. Tamb\u00e9m forneceremos dicas essenciais para garantir a execu\u00e7\u00e3o bem-sucedida e a remo\u00e7\u00e3o de dados.<\/p>\n<h2>O poder do PowerShell para gerenciamento de disco<\/h2>\n<p>O PowerShell, a poderosa linguagem de script da Microsoft, oferece amplos recursos para gerenciar e proteger dados. Com suas funcionalidades robustas, como a capacidade de formatar discos e limpar discos r\u00edgidos, o PowerShell se torna uma ferramenta inestim\u00e1vel para qualquer pessoa que lide com tarefas frequentes de gerenciamento de dados.<\/p>\n<h2>Liberando o potencial do script do PowerShell para limpeza remota<\/h2>\n<p>O script do PowerShell em discuss\u00e3o foi criado para executar uma limpeza remota em um dispositivo. Ele \u00e9 capaz de executar v\u00e1rios m\u00e9todos, cada um fornecendo n\u00edveis variados de exclus\u00e3o de dados e redefini\u00e7\u00e3o do sistema para atender a diferentes requisitos de seguran\u00e7a de dados.<\/p>\n<p>Mas como voc\u00ea garante que esse script seja executado corretamente e que todos os dados sejam apagados com \u00eaxito do disco r\u00edgido? Aqui est\u00e3o algumas dicas:<\/p>\n<ol>\n<li><strong> Verifique a compatibilidade:<\/strong> Certifique-se de que o sistema de destino seja compat\u00edvel com o m\u00e9todo escolhido. Por exemplo, os m\u00e9todos &#8220;WipeProtected&#8221; e &#8220;WipePersistUserData&#8221; s\u00e3o compat\u00edveis apenas com vers\u00f5es espec\u00edficas do Windows 10 ou superiores.<\/li>\n<li><strong> Verificar o nome do computador:<\/strong> O par\u00e2metro ComputerName precisa corresponder ao nome do computador em que o script est\u00e1 sendo executado. Se isso n\u00e3o acontecer, o script ser\u00e1 encerrado sem fazer nenhuma altera\u00e7\u00e3o. A chave ComputerNameBypass pode ser usada para substituir isso.<\/li>\n<li><strong> Teste antes da implementa\u00e7\u00e3o:<\/strong> Sempre teste o script em um ambiente controlado antes de implant\u00e1-lo em um ambiente de produ\u00e7\u00e3o. Isso ajuda a identificar e corrigir quaisquer problemas antes que eles afetem os sistemas essenciais.<\/li>\n<li><strong> Monitorar a execu\u00e7\u00e3o do script:<\/strong> Fique de olho na execu\u00e7\u00e3o do script. Preste aten\u00e7\u00e3o a todos os erros ou exce\u00e7\u00f5es lan\u00e7ados pelo script. Essas mensagens podem fornecer informa\u00e7\u00f5es valiosas sobre quaisquer problemas que possam surgir.<\/li>\n<li><strong> Verify Data Wipe (Verificar limpeza de dados):<\/strong> Ap\u00f3s a execu\u00e7\u00e3o do script, verifique se a limpeza de dados foi bem-sucedida. Isso pode ser feito tentando recuperar dados da unidade. Se a recupera\u00e7\u00e3o for imposs\u00edvel, o apagamento de dados pode ser considerado bem-sucedido.<\/li>\n<li><strong> Documentar o processo:<\/strong> Mantenha um registro de todo o processo, desde a execu\u00e7\u00e3o do script inicial at\u00e9 a verifica\u00e7\u00e3o da limpeza de dados. Essa documenta\u00e7\u00e3o pode ser um recurso valioso para refer\u00eancia futura ou em caso de auditorias.<\/li>\n<\/ol>\n<h2>O roteiro: Limpeza remota de um dispositivo Windows<\/h2>\n<p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\"> #Requires -Version 5.1\r\n\r\n&lt;#\r\n.SYNOPSIS\r\n    Remote Wipe a device.\r\n.DESCRIPTION\r\n    Remote Wipe a device via InvokeMethod from a Cim Session. doWipe, doWipeProtected, doWipePersistUserData, and doWipePersistProvisionedData are supported.\r\n    See examples for how to use each.\r\n.EXAMPLE\r\n    -Method Wipe -ComputerName \"PC-001\"\r\n    Runs the doWipe method. Equivalent to running \"Reset this PC &gt; Remove everything\" from the Settings app, with Clean Data set to No and Delete Files set to Yes.\r\n    ComputerName needs to match the computer name of the computer the script is running on. If it doesn't then the script will exit, doing nothing.\r\n.EXAMPLE\r\n    -Method Wipe -ComputerNameBypass\r\n    Runs the doWipe method. Equivalent to running \"Reset this PC &gt; Remove everything\" from the Settings app, with Clean Data set to No and Delete Files set to Yes.\r\n    Will bypass the computer name check and run regards less.\r\n.EXAMPLE\r\n    -Method WipeProtected -ComputerName \"PC-001\"\r\n    Runs the doWipeProtected method. Performs a remote reset on the device and also fully cleans the internal drive.\r\n    Windows 10 build version 1703 and above.\r\n    ComputerName needs to match the computer name of the computer the script is running on. If it doesn't then the script will exit, doing nothing.\r\n.EXAMPLE\r\n    -Method WipePersistUserData\r\n    Runs the doWipeProtected method. Equivalent to selecting \"Reset this PC &gt; Keep my files\" when manually starting a reset from the Settings app.\r\n    Windows 10 build version 1709 and above.\r\n    ComputerName needs to match the computer name of the computer the script is running on. If it doesn't then the script will exit, doing nothing.\r\n.EXAMPLE\r\n    -Method WipePersistProvisionedData\r\n    Runs the doWipeProtected method. Provisioning packages in the %SystemDrive%ProgramDataMicrosoftProvisioning folder will be retained and then applied to the OS after the reset.\r\n    The information that was backed up will be restored and applied to the device when it resumes.\r\n    ComputerName needs to match the computer name of the computer the script is running on. If it doesn't then the script will exit, doing nothing.\r\n.NOTES\r\n    Reference: https:\/\/docs.microsoft.com\/en-us\/windows\/client-management\/mdm\/remotewipe-csp\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(Mandatory = $true)]\r\n    [ValidateSet(\"Wipe\", \"WipeProtected\", \"WipePersistProvisionedData\", \"WipePersistUserData\")]\r\n    [String]\r\n    $Method,\r\n    [Parameter()]\r\n    [String]\r\n    $ComputerName,\r\n    [Parameter()]\r\n    [switch]\r\n    $ComputerNameBypass\r\n)\r\n\r\n# ComputerNameBypass was used, continue on.\r\nif ($PSBoundParameters.ContainsKey(\"ComputerNameBypass\") -and $ComputerNameBypass) {\r\n    Write-Host \"Bypassing Computer Name check.\"\r\n}\r\nelse {\r\n    # If computer name matches, continue on.\r\n    if ($ComputerName -notlike $env:COMPUTERNAME) {\r\n        Write-Error \"Computer Name does not match.\"\r\n        exit 1\r\n    }\r\n}\r\n\r\n# Check if the requested Method is supported or not\r\n$BuildVersion = [System.Environment]::OSVersion.Version.Build\r\nif ($BuildVersion -lt 1703 -and $Method -like \"WipeProtected\") {\r\n    Write-Host \"WipeProtected is only supported on Windows 10 build version 1703 and above.\"\r\n    exit 1\r\n}\r\nif ($BuildVersion -lt 1709 -and $Method -like \"WipePersistUserData\") {\r\n    Write-Host \"WipePersistUserData is only supported on Windows 10 build version 1709 and above.\"\r\n    exit 1\r\n}\r\n\r\n$session = New-CimSession\r\n\r\n$params = New-Object Microsoft.Management.Infrastructure.CimMethodParametersCollection\r\n$param = [Microsoft.Management.Infrastructure.CimMethodParameter]::Create(\"param\", \"\", \"String\", \"In\")\r\n$params.Add($param)\r\n\r\n$CimSplat = @{\r\n    Namespace = \"rootcimv2mdmdmmap\"\r\n    ClassName = \"MDM_RemoteWipe\"\r\n    Filter    = \"ParentID='.\/Vendor\/MSFT' and InstanceID='RemoteWipe'\"\r\n}\r\n\r\ntry {\r\n    $instance = Get-CimInstance @CimSplat\r\n    $session.InvokeMethod($CimSplat[\"Namespace\"], $instance, \"do$($Method)Method\", $params)\r\n}\r\ncatch {\r\n    Write-Error $_\r\n    exit 1\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<br \/>\n<div class=\"in-context-cta\"><p>Acesse mais de 300 scripts no NinjaOne Dojo<\/p>\n<p><a href=\"https:\/\/www.ninjaone.com\/freetrialform\/\">Obter acesso<\/a><\/p>\n<\/div><\/p>\n<p>Os scripts do PowerShell, como o discutido nesta postagem do blog, podem ser ferramentas poderosas para profissionais de TI e MSPs, proporcionando efici\u00eancia e seguran\u00e7a robusta dos dados. Com uma compreens\u00e3o clara do script e seguindo essas dicas, voc\u00ea pode garantir uma execu\u00e7\u00e3o bem-sucedida e a limpeza segura dos dados. No \u00e2mbito do gerenciamento de dados, ter essas ferramentas e conhecimentos confi\u00e1veis \u00e9 inestim\u00e1vel.<\/p>\n<p>Voc\u00ea pode estar se perguntando: &#8220;E quanto \u00e0 limpeza de um disco r\u00edgido do Mac?&#8221;, e n\u00f3s o ajudamos. Confira nossa postagem no blog sobre<a href=\"https:\/\/www.ninjaone.com\/blog\/wipe-a-mac-hard-drive-remotely-bash-script\/\">&#8220;Como limpar um disco r\u00edgido do Mac com um script Bash<\/a>&#8220;.<\/p>\n<p>Um clique para proteger sua frota &#8211;\u00a0watch<a href=\"https:\/\/www.ninjaone.com\/videos\/mdm\/issuing-a-remote-wipe\/\">\u00a0emitir um apagamento remoto<\/a>\u00a0e capacitar sua equipe de TI.<\/p>\n<h2>Como o NinjaOne pode ajudar<\/h2>\n<p>Para as organiza\u00e7\u00f5es que desejam elevar a seguran\u00e7a de seus dados e o gerenciamento de TI a um novo patamar, a integra\u00e7\u00e3o de uma solu\u00e7\u00e3o como o NinjaOne pode fazer uma diferen\u00e7a significativa. Embora os scripts do PowerShell sejam eficientes para tarefas como a limpeza de disco, o gerenciamento desses scripts em um grande n\u00famero de dispositivos pode ser complicado. O NinjaOne simplifica isso oferecendo <a href=\"https:\/\/www.ninjaone.com\/pt-br\/rmm\/automacao-de-ti\/\">recursos de automa\u00e7\u00e3o e implementa\u00e7\u00e3o de scripts centralizados<\/a>. Voc\u00ea pode implementar seus scripts do PowerShell para limpar dados remotamente em v\u00e1rios dispositivos, tudo a partir de um \u00fanico painel.<\/p>\n<p>Al\u00e9m disso, o NinjaOne oferece relat\u00f3rios e an\u00e1lises avan\u00e7ados, para que voc\u00ea possa verificar facilmente o sucesso de suas opera\u00e7\u00f5es de limpeza de dados e manter registros de conformidade. Caso o script tenha problemas ou exce\u00e7\u00f5es, o monitoramento em tempo real do NinjaOne o alertar\u00e1, permitindo uma interven\u00e7\u00e3o r\u00e1pida. Isso minimiza os riscos e garante que seu processo de remo\u00e7\u00e3o de dados seja completo e seguro.<\/p>\n<p>Portanto, seja voc\u00ea um profissional de TI ou um provedor de servi\u00e7os gerenciados, a integra\u00e7\u00e3o do NinjaOne \u00e0s suas pr\u00e1ticas de seguran\u00e7a e gerenciamento de dados pode oferecer uma camada extra de efici\u00eancia e confiabilidade. N\u00e3o se trata apenas de executar um script; trata-se de gerenci\u00e1-lo de forma eficaz em toda a organiza\u00e7\u00e3o, e o NinjaOne pode ajud\u00e1-lo a fazer exatamente isso. <a href=\"https:\/\/www.ninjaone.com\/pt-br\/demonstracao-gratuita-do-gerenciamento-de-terminais\/\">Assista a uma demonstra\u00e7\u00e3o<\/a> e veja por que o NinjaOne foi eleito o <a href=\"https:\/\/www.ninjaone.com\/pt-br\/gerenciamento-de-endpoints\/\">software de gerenciamento de endpoint<\/a> n\u00ba 1 no G2 Crowd.<\/p>\n","protected":false},"author":35,"featured_media":141601,"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-807218","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\/807218","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=807218"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/pt-br\/wp-json\/wp\/v2\/media\/141601"}],"wp:attachment":[{"href":"https:\/\/www.ninjaone.com\/pt-br\/wp-json\/wp\/v2\/media?parent=807218"}],"wp:term":[{"taxonomy":"script_hub_category","embeddable":true,"href":"https:\/\/www.ninjaone.com\/pt-br\/wp-json\/wp\/v2\/operating_system?post=807218"},{"taxonomy":"use_cases","embeddable":true,"href":"https:\/\/www.ninjaone.com\/pt-br\/wp-json\/wp\/v2\/use_cases?post=807218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}