{"id":2503,"date":"2013-11-29T11:59:00","date_gmt":"2013-11-29T11:59:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2013\/11\/29\/powertip-use-powershell-to-clear-the-trusted-hosts-file\/"},"modified":"2013-11-29T11:59:00","modified_gmt":"2013-11-29T11:59:00","slug":"powertip-use-powershell-to-clear-the-trusted-hosts-file","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/powertip-use-powershell-to-clear-the-trusted-hosts-file\/","title":{"rendered":"PowerTip: Use PowerShell to Clear the Trusted Hosts File"},"content":{"rendered":"<p><strong>Summary<\/strong>: Use Windows PowerShell to clear the trusted hosts file.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Question\">&nbsp;How can I use Windows PowerShell to clear all values from my trusted hosts file?<\/p>\n<p style=\"padding-left: 30px\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Answer\">The trusted hosts file is part of the WSMAN configuration, and the easiest way to clear it is to use&nbsp;<strong>Clear-Item<\/strong>:<\/p>\n<p style=\"padding-left: 120px\">&pound;&gt; Get-Item -Path WSMan:localhostClientTrustedHosts | fl Name, Value<\/p>\n<p style=\"padding-left: 120px\">Name&nbsp; : TrustedHosts<\/p>\n<p style=\"padding-left: 120px\">Value : server02,10.10.54.201<\/p>\n<p style=\"padding-left: 120px\">&pound;&gt; Clear-Item -Path WSMan:localhostClientTrustedHosts -Force<\/p>\n<p style=\"padding-left: 120px\">&pound;&gt; Get-Item -Path WSMan:localhostClientTrustedHosts | fl Name, Value<\/p>\n<p style=\"padding-left: 120px\">Name&nbsp; : TrustedHosts<\/p>\n<p style=\"padding-left: 120px\">Value :<\/p>\n<p style=\"padding-left: 60px\"><strong>Note<\/strong>&nbsp;&nbsp;If you don&rsquo;t use the&nbsp;<strong>&ndash;Force<\/strong>&nbsp;parameter on&nbsp;<strong>Clear-Item<\/strong>, you must respond to a message asking you to confirm the action.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Use Windows PowerShell to clear the trusted hosts file. &nbsp;How can I use Windows PowerShell to clear all values from my trusted hosts file? The trusted hosts file is part of the WSMAN configuration, and the easiest way to clear it is to use&nbsp;Clear-Item: &pound;&gt; Get-Item -Path WSMan:localhostClientTrustedHosts | fl Name, Value Name&nbsp; : [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[356,57,189,4,45],"class_list":["post-2503","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-powertip","tag-remoting","tag-richard-siddaway","tag-scripting-techniques","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Summary: Use Windows PowerShell to clear the trusted hosts file. &nbsp;How can I use Windows PowerShell to clear all values from my trusted hosts file? The trusted hosts file is part of the WSMAN configuration, and the easiest way to clear it is to use&nbsp;Clear-Item: &pound;&gt; Get-Item -Path WSMan:localhostClientTrustedHosts | fl Name, Value Name&nbsp; : [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/2503","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=2503"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/2503\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=2503"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=2503"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=2503"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}