How To: Modify Trusted Hosts to connect via Powershell

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:

Then to get them to modify:

copy that out, add your hosts to it with comma delimited and add it with powershell:

To use it in code (so it doesn’t ask you if you’re sure), you can force it by using the -Force switch

then check again:

Leave a Reply

Your email address will not be published. Required fields are marked *