{"id":191,"date":"2017-08-29T20:14:42","date_gmt":"2017-08-29T20:14:42","guid":{"rendered":"http:\/\/www.edrockwell.com\/blog\/?p=191"},"modified":"2017-09-01T02:28:06","modified_gmt":"2017-09-01T02:28:06","slug":"how-to-modify-trusted-hosts-to-connect-via-powershell","status":"publish","type":"post","link":"https:\/\/www.edrockwell.com\/blog\/how-to-modify-trusted-hosts-to-connect-via-powershell\/","title":{"rendered":"How To: Modify Trusted Hosts to connect via Powershell"},"content":{"rendered":"<p>We have to connect to untrusted machines via PowerShell. To do this, you have to add the machines,<\/p>\n<p>First, if you have settings in there run this command to get a backup:<\/p>\n<pre class=\"lang:ps decode:true\">$trustedhosts = get-Item -Path WSMan:\\localhost\\Client\\TrustedHosts<\/pre>\n<p>Then to get them to modify:<\/p>\n<pre class=\"lang:ps decode:true \" >$trustedhosts.value<\/pre>\n<p>copy that out, add your hosts to it with comma delimited and add it with powershell:<\/p>\n<pre class=\"lang:ps decode:true \" >Set-Item WSMan:\\localhost\\Client\\TrustedHosts -Value 'Server2,Server2'<\/pre>\n<p>To use it in code (so it doesn&#8217;t ask you if you&#8217;re sure), you can force it by using the -Force switch<\/p>\n<pre class=\"lang:ps decode:true \" >Set-Item WSMan:\\localhost\\Client\\TrustedHosts -Value 'Server2,Server2' -Force<\/pre>\n<p>then check again:<\/p>\n<pre class=\"lang:ps decode:true \" >get-Item -Path WSMan:\\localhost\\Client\\TrustedHosts<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>We have to connect to untrusted machines via PowerShell. To do this, you have to add the machines, First, if you have settings in there run this command to get a backup: $trustedhosts = get-Item -Path WSMan:\\localhost\\Client\\TrustedHosts Then to get them to modify: $trustedhosts.value copy that out, add your hosts to it with comma delimited [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":195,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[21,87],"class_list":["post-191","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell","tag-powershell-2","tag-trusted-hosts"],"aioseo_notices":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How To: Modify Trusted Hosts to connect via Powershell - System Admin [RESOLVED]<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.edrockwell.com\/blog\/how-to-modify-trusted-hosts-to-connect-via-powershell\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To: Modify Trusted Hosts to connect via Powershell - System Admin [RESOLVED]\" \/>\n<meta property=\"og:description\" content=\"We have to connect to untrusted machines via PowerShell. To do this, you have to add the machines, First, if you have settings in there run this command to get a backup: $trustedhosts = get-Item -Path WSMan:localhostClientTrustedHosts Then to get them to modify: $trustedhosts.value copy that out, add your hosts to it with comma delimited [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.edrockwell.com\/blog\/how-to-modify-trusted-hosts-to-connect-via-powershell\/\" \/>\n<meta property=\"og:site_name\" content=\"System Admin [RESOLVED]\" \/>\n<meta property=\"article:published_time\" content=\"2017-08-29T20:14:42+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-09-01T02:28:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.edrockwell.com\/blog\/wp-content\/uploads\/2017\/08\/powershell.png\" \/>\n\t<meta property=\"og:image:width\" content=\"391\" \/>\n\t<meta property=\"og:image:height\" content=\"256\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Ed Rockwell\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@EddieRock\" \/>\n<meta name=\"twitter:site\" content=\"@EddieRock\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ed Rockwell\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.edrockwell.com\/blog\/how-to-modify-trusted-hosts-to-connect-via-powershell\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.edrockwell.com\/blog\/how-to-modify-trusted-hosts-to-connect-via-powershell\/\"},\"author\":{\"name\":\"Ed Rockwell\",\"@id\":\"https:\/\/www.edrockwell.com\/blog\/#\/schema\/person\/e181b98aceccea720abee0c25bbfbcd7\"},\"headline\":\"How To: Modify Trusted Hosts to connect via Powershell\",\"datePublished\":\"2017-08-29T20:14:42+00:00\",\"dateModified\":\"2017-09-01T02:28:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.edrockwell.com\/blog\/how-to-modify-trusted-hosts-to-connect-via-powershell\/\"},\"wordCount\":90,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/www.edrockwell.com\/blog\/how-to-modify-trusted-hosts-to-connect-via-powershell\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.edrockwell.com\/blog\/wp-content\/uploads\/2017\/08\/powershell.png\",\"keywords\":[\"Powershell\",\"Trusted Hosts\"],\"articleSection\":[\"PowerShell\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.edrockwell.com\/blog\/how-to-modify-trusted-hosts-to-connect-via-powershell\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.edrockwell.com\/blog\/how-to-modify-trusted-hosts-to-connect-via-powershell\/\",\"url\":\"https:\/\/www.edrockwell.com\/blog\/how-to-modify-trusted-hosts-to-connect-via-powershell\/\",\"name\":\"How To: Modify Trusted Hosts to connect via Powershell - System Admin [RESOLVED]\",\"isPartOf\":{\"@id\":\"https:\/\/www.edrockwell.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.edrockwell.com\/blog\/how-to-modify-trusted-hosts-to-connect-via-powershell\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.edrockwell.com\/blog\/how-to-modify-trusted-hosts-to-connect-via-powershell\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.edrockwell.com\/blog\/wp-content\/uploads\/2017\/08\/powershell.png\",\"datePublished\":\"2017-08-29T20:14:42+00:00\",\"dateModified\":\"2017-09-01T02:28:06+00:00\",\"author\":{\"@id\":\"https:\/\/www.edrockwell.com\/blog\/#\/schema\/person\/e181b98aceccea720abee0c25bbfbcd7\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.edrockwell.com\/blog\/how-to-modify-trusted-hosts-to-connect-via-powershell\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.edrockwell.com\/blog\/how-to-modify-trusted-hosts-to-connect-via-powershell\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.edrockwell.com\/blog\/how-to-modify-trusted-hosts-to-connect-via-powershell\/#primaryimage\",\"url\":\"https:\/\/www.edrockwell.com\/blog\/wp-content\/uploads\/2017\/08\/powershell.png\",\"contentUrl\":\"https:\/\/www.edrockwell.com\/blog\/wp-content\/uploads\/2017\/08\/powershell.png\",\"width\":391,\"height\":256},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.edrockwell.com\/blog\/how-to-modify-trusted-hosts-to-connect-via-powershell\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.edrockwell.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To: Modify Trusted Hosts to connect via Powershell\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.edrockwell.com\/blog\/#website\",\"url\":\"https:\/\/www.edrockwell.com\/blog\/\",\"name\":\"System Admin [RESOLVED]\",\"description\":\"How To: Make My DevOps Life Easier\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.edrockwell.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.edrockwell.com\/blog\/#\/schema\/person\/e181b98aceccea720abee0c25bbfbcd7\",\"name\":\"Ed Rockwell\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/dea3152d7acd78aa28d280207c33f7ec516731ece9a54249cbbbebcfffc341e0?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/dea3152d7acd78aa28d280207c33f7ec516731ece9a54249cbbbebcfffc341e0?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/dea3152d7acd78aa28d280207c33f7ec516731ece9a54249cbbbebcfffc341e0?s=96&d=mm&r=g\",\"caption\":\"Ed Rockwell\"},\"sameAs\":[\"http:\/\/www.therockwells.net\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How To: Modify Trusted Hosts to connect via Powershell - System Admin [RESOLVED]","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.edrockwell.com\/blog\/how-to-modify-trusted-hosts-to-connect-via-powershell\/","og_locale":"en_US","og_type":"article","og_title":"How To: Modify Trusted Hosts to connect via Powershell - System Admin [RESOLVED]","og_description":"We have to connect to untrusted machines via PowerShell. To do this, you have to add the machines, First, if you have settings in there run this command to get a backup: $trustedhosts = get-Item -Path WSMan:localhostClientTrustedHosts Then to get them to modify: $trustedhosts.value copy that out, add your hosts to it with comma delimited [&hellip;]","og_url":"https:\/\/www.edrockwell.com\/blog\/how-to-modify-trusted-hosts-to-connect-via-powershell\/","og_site_name":"System Admin [RESOLVED]","article_published_time":"2017-08-29T20:14:42+00:00","article_modified_time":"2017-09-01T02:28:06+00:00","og_image":[{"width":391,"height":256,"url":"https:\/\/www.edrockwell.com\/blog\/wp-content\/uploads\/2017\/08\/powershell.png","type":"image\/png"}],"author":"Ed Rockwell","twitter_card":"summary_large_image","twitter_creator":"@EddieRock","twitter_site":"@EddieRock","twitter_misc":{"Written by":"Ed Rockwell","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.edrockwell.com\/blog\/how-to-modify-trusted-hosts-to-connect-via-powershell\/#article","isPartOf":{"@id":"https:\/\/www.edrockwell.com\/blog\/how-to-modify-trusted-hosts-to-connect-via-powershell\/"},"author":{"name":"Ed Rockwell","@id":"https:\/\/www.edrockwell.com\/blog\/#\/schema\/person\/e181b98aceccea720abee0c25bbfbcd7"},"headline":"How To: Modify Trusted Hosts to connect via Powershell","datePublished":"2017-08-29T20:14:42+00:00","dateModified":"2017-09-01T02:28:06+00:00","mainEntityOfPage":{"@id":"https:\/\/www.edrockwell.com\/blog\/how-to-modify-trusted-hosts-to-connect-via-powershell\/"},"wordCount":90,"commentCount":0,"image":{"@id":"https:\/\/www.edrockwell.com\/blog\/how-to-modify-trusted-hosts-to-connect-via-powershell\/#primaryimage"},"thumbnailUrl":"https:\/\/www.edrockwell.com\/blog\/wp-content\/uploads\/2017\/08\/powershell.png","keywords":["Powershell","Trusted Hosts"],"articleSection":["PowerShell"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.edrockwell.com\/blog\/how-to-modify-trusted-hosts-to-connect-via-powershell\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.edrockwell.com\/blog\/how-to-modify-trusted-hosts-to-connect-via-powershell\/","url":"https:\/\/www.edrockwell.com\/blog\/how-to-modify-trusted-hosts-to-connect-via-powershell\/","name":"How To: Modify Trusted Hosts to connect via Powershell - System Admin [RESOLVED]","isPartOf":{"@id":"https:\/\/www.edrockwell.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.edrockwell.com\/blog\/how-to-modify-trusted-hosts-to-connect-via-powershell\/#primaryimage"},"image":{"@id":"https:\/\/www.edrockwell.com\/blog\/how-to-modify-trusted-hosts-to-connect-via-powershell\/#primaryimage"},"thumbnailUrl":"https:\/\/www.edrockwell.com\/blog\/wp-content\/uploads\/2017\/08\/powershell.png","datePublished":"2017-08-29T20:14:42+00:00","dateModified":"2017-09-01T02:28:06+00:00","author":{"@id":"https:\/\/www.edrockwell.com\/blog\/#\/schema\/person\/e181b98aceccea720abee0c25bbfbcd7"},"breadcrumb":{"@id":"https:\/\/www.edrockwell.com\/blog\/how-to-modify-trusted-hosts-to-connect-via-powershell\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.edrockwell.com\/blog\/how-to-modify-trusted-hosts-to-connect-via-powershell\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.edrockwell.com\/blog\/how-to-modify-trusted-hosts-to-connect-via-powershell\/#primaryimage","url":"https:\/\/www.edrockwell.com\/blog\/wp-content\/uploads\/2017\/08\/powershell.png","contentUrl":"https:\/\/www.edrockwell.com\/blog\/wp-content\/uploads\/2017\/08\/powershell.png","width":391,"height":256},{"@type":"BreadcrumbList","@id":"https:\/\/www.edrockwell.com\/blog\/how-to-modify-trusted-hosts-to-connect-via-powershell\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.edrockwell.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How To: Modify Trusted Hosts to connect via Powershell"}]},{"@type":"WebSite","@id":"https:\/\/www.edrockwell.com\/blog\/#website","url":"https:\/\/www.edrockwell.com\/blog\/","name":"System Admin [RESOLVED]","description":"How To: Make My DevOps Life Easier","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.edrockwell.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.edrockwell.com\/blog\/#\/schema\/person\/e181b98aceccea720abee0c25bbfbcd7","name":"Ed Rockwell","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/dea3152d7acd78aa28d280207c33f7ec516731ece9a54249cbbbebcfffc341e0?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/dea3152d7acd78aa28d280207c33f7ec516731ece9a54249cbbbebcfffc341e0?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/dea3152d7acd78aa28d280207c33f7ec516731ece9a54249cbbbebcfffc341e0?s=96&d=mm&r=g","caption":"Ed Rockwell"},"sameAs":["http:\/\/www.therockwells.net"]}]}},"_links":{"self":[{"href":"https:\/\/www.edrockwell.com\/blog\/wp-json\/wp\/v2\/posts\/191","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.edrockwell.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.edrockwell.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.edrockwell.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.edrockwell.com\/blog\/wp-json\/wp\/v2\/comments?post=191"}],"version-history":[{"count":2,"href":"https:\/\/www.edrockwell.com\/blog\/wp-json\/wp\/v2\/posts\/191\/revisions"}],"predecessor-version":[{"id":194,"href":"https:\/\/www.edrockwell.com\/blog\/wp-json\/wp\/v2\/posts\/191\/revisions\/194"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.edrockwell.com\/blog\/wp-json\/wp\/v2\/media\/195"}],"wp:attachment":[{"href":"https:\/\/www.edrockwell.com\/blog\/wp-json\/wp\/v2\/media?parent=191"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.edrockwell.com\/blog\/wp-json\/wp\/v2\/categories?post=191"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.edrockwell.com\/blog\/wp-json\/wp\/v2\/tags?post=191"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}